#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; int main() { int N; int A[110]; bool flag = 1; cin >> N; vector q; 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; } } } printf("%d\n",q.size()); for (int i = 0; i < q.size(); i++) { printf("%d %d\n",q[i].first,q[i].second); } int damy; cin >> damy; return 0; }