P1116 车厢重组
// Problem: P1116 车厢重组
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1116
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// User: Pannnn
#include
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector info(n);
for (int i = 0; i < n; ++i) {
cin >> info[i];
}
long long cnt = 0;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
if (info[i] > info[j]) {
++cnt;
}
}
}
cout << cnt << endl;
return 0;
}