#include using namespace std; // one-based numbering struct Fenwick { vector bit; int N; Fenwick(int n) { N = n; bit.resize(n+1, 0); } void add(int a, int w) { for (int x = a; x <= N; x += x & -x) bit[x] += w; } int sum(int a) { int ret = 0; for (int x = a; x > 0; x -= x & -x) ret += bit[x]; return ret; } }; int main(){ int n; cin >> n; vector v(n); vector< pair > p(n); for (int i = 0; i < n; i++) { cin >> p[i].first; p[i].second = i; } sort(p.begin(), p.end()); for (int i = 0; i < n; i++) { v[p[i].second] = i+1; } long long tmp = 0; Fenwick f = Fenwick(n); for (int i = 0; i < n; i++) { tmp += (long long) (i - f.sum(v[i])); f.add(v[i], 1); } cout << tmp << endl; for (int i = 0; i < n-1; i++) { tmp += (n - v[i]) - (v[i]-1); cout << tmp << endl; } return 0; }