#include #define MAX 100005 #define ll long long using namespace std; int a[MAX], n; ll c[MAX]; ll getBit(int x) { ll tong=0; for (;x>0; x&=(x-1)) tong+=c[x]; return tong; } ll update(int x) { for (;x<=MAX; x+=x&(-x)) { c[x]+=1; } } void Solve() { ll kq=0; for (int i=n; i>=1; i--) { kq+=getBit(a[i]); update(a[i]+1); } cout<> n; for (int i=1; i<=n; i++) cin >> a[i]; Solve(); return 0; }