#include <bits/stdc++.h>
using namespace std;
int pov(int a, int b) {
  int n = 1;
  for (int i = 0; i < b; i++) {
    n *= a;
  }
  return n;
}
void sort(int A[], int l, int r) {
  if (r - l < 2) {
    return;
  }
  int mid = (r + l) / 2;
  sort(A, l, mid);
  sort(A, mid, r);
  int B[r - l];
  int x = l;
  int y = mid;
  for (int i = 0; i < r - l; i++) {
    if (A[x] <= A[y] && x < mid && y < r) {
      B[i] = A[x];
      x++;
    } else if (y < r) {
      B[i] = A[y];
      y++;
    } else {
      B[i] = A[x];
      x++;
    }
  }
  for (int i = 0; i < r - l; i++) A[l + i] = B[i];
}
int x[200099];
int y[200099];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, res[4000][2], c = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    y[i] = x[i];
  }
  sort(y, 0, n);
  for (int i = 0; i < n; i++) {
    if (x[i] != y[i]) {
      for (int j = i + 1; j < n; j++) {
        if (x[j] == y[i]) {
          int t = x[j];
          x[j] = x[i];
          x[i] = t;
          res[c][0] = j;
          res[c][1] = i;
          c++;
          break;
        }
      }
    }
  }
  cout << c << '\n';
  for (int i = 0; i < c; i++) {
    cout << res[i][0] << ' ' << res[i][1] << '\n';
  }
  return 0;
}
