#include #include #include using namespace std; typedef long long ll; ll N; ll merge_count(vector &a){ int n = a.size(); if(n<=1) return 0; ll cnt = 0; vector b(a.begin(),a.begin() + n/2); vector c(a.begin() + n/2, a.end()); cnt += merge_count(b); cnt += merge_count(c); int ai = 0,bi = 0,ci = 0; while(ai> N; vector v,A; for(int i=0;i> a; v.push_back(a); A.push_back(a); } ll ans[N]; ans[N-1] = merge_count(v); sort(v.begin(),v.end()); for(int i=0;i