#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<pair<long long, long long>> res;
  for (int i = 0; i < n; i++) {
    int j = i;
    for (int k = i; k < n; k++) {
      if (arr[j] > arr[k]) j = k;
    }
    if (j != i) {
      swap(arr[j], arr[i]);
      res.push_back({i, j});
    }
  }
  cout << res.size() << "\n";
  for (int i = 0; i < res.size(); i++) {
    cout << res[i].first << " " << res[i].second << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
}
