#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e6+10; int n, a[N]; int tmp[N]; inline void merge_sort(int *a, int l, int r) { if(l >= r) return ; int mid = (l+r)>>1; merge_sort(a, l, mid); merge_sort(a, mid+1, r); int cnt = 0, i...