#include <bits/stdc++.h>
using namespace std;
int N, Ai[3010];
void read();
void solve();
int main() {
  read();
  solve();
  return 0;
}
void read() {
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> Ai[i];
}
void solve() {
  cout << N << "\n";
  for (int i = 0; i < N; ++i) {
    int c = i;
    for (int j = i + 1; j < N; ++j)
      if (Ai[c] > Ai[j]) c = j;
    cout << i << " " << c << "\n";
    swap(Ai[i], Ai[c]);
  }
}
