#include #include #include #include using namespace std; int main() { //int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0; int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0; //cout << LONG_MAX << endl; int x[100001] = {}; int y[100001] = {}; //string s[1001]; int n; cin >> n; for (a = 0; a < n; a++) { cin >> x[a]; } for (a = 0; a < n; a++) { for (b = 0; b < n; b++) { if (a != b) { if (x[a] < x[b]) { y[a]++; } else if (x[a] > x[b]) { y[a]--; } } } } int cnt = 0; for (a = 0; a < n; a++) { for (b = 0; b < n - 1; b++) { if (x[b] > x[b + 1]) { c = x[b]; x[b] = x[b + 1]; x[b + 1] = c; cnt++; } } } for (a = 0; a < n; a++) { cout << cnt << endl; cnt += y[a]; } //cout << "aaaaaaa" << endl; return 0; }