#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long MOD = 1e+9 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
const long long MAXN = 1e+5 + 7;
vector<long long> adj[MAXN];
long long visit[MAXN] = {};
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
int t = 1;
long long n;
long long a[3005];
vector<pair<long long, long long> > v;
void MAIN() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    long long j = i + 1;
    long long min1 = a[i];
    long long pos = i;
    while (j < n) {
      if (min1 > a[j]) {
        min1 = a[j];
        pos = j;
      }
      j++;
    }
    swap(a[pos], a[i]);
    v.push_back({i, pos});
  }
  cout << v.size() << endl;
  long long len = v.size();
  for (long long i = 0; i < len; i++)
    cout << v[i].first << " " << v[i].second << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  ;
  mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
  ;
  while (t--) {
    MAIN();
  }
}
