#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pl; int main() { int N; int A[110]; bool flag = 1; vector q; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; flag; i++) { flag = 0; for (int j = N-1; j >= i; j--) { if (A[j - 1] > A[j]) { swap(A[j-1],A[j]); q.push_back({j-1,j}); flag = 1; } } } cout << q.size() << endl; for (int i = 0; i < q.size(); i++) { cout << q[i].first << " " << q[i].second << endl; } int damy; cin >> damy; return 0; }