#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
const bool db = false;
int n, a[100010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  vector<pair<int, int> > ans;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == *min_element(a + i, a + n + 1)) continue;
    ans.push_back(make_pair(i, min_element(a + i, a + n + 1) - a));
    swap(a[i], a[min_element(a + i, a + n + 1) - a]);
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i)
    cout << ans[i].first - 1 << " " << ans[i].second - 1 << endl;
  getchar();
  getchar();
  return 0;
}
