#include <bits/stdc++.h>
using namespace std;
int A[3003], B[3003];
vector<pair<int, int> > X;
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    B[i] = A[i];
  }
  sort(B, B + N);
  for (int i = 0; i < N; i++) {
    if (A[i] == B[i]) continue;
    int k = 0;
    for (int j = i + 1; j < N; j++)
      if (A[j] == B[i]) {
        k = j;
        break;
      }
    swap(A[i], A[k]);
    X.push_back({i, k});
  }
  printf("%d\n", X.size());
  for (int i = 0; i < X.size(); i++) printf("%d %d\n", X[i].first, X[i].second);
  return 0;
}
