#include using namespace std; using ll = long long; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b &A){ ll N = A.size(); // iまで見る for(int i=N-1; i>=0; i--){ FOR(j, 0, i){ if(A[j] > A[j+1]){ cnt++; swap(A[j], A[j+1]); } } } } int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll N; cin >> N; vector A(N); FOR(i, 0, N){ cin >> A.at(i); } bubble_sort(A); p(cnt); return 0; }