#include <bits/stdc++.h>
using namespace std;
long long a[200009];
long long b[200009];
long long c[200009];
long long d[200009];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b, b + n);
  long long k = 0;
  long long h;
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) {
      for (int j = i; j < n; j++) {
        if (a[j] == b[i]) {
          h = a[i];
          a[i] = a[j];
          a[j] = h;
          c[k] = i;
          d[k] = j;
          k++;
          break;
        }
      }
    }
  }
  cout << k << endl;
  for (int i = 0; i < k; i++) cout << c[i] << " " << d[i] << endl;
}
