#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d, n, m, num = 0, num2 = 0, sum = 0, mn, sum2 = 0;
  cin >> n;
  vector<long long> vec, vec2;
  vector<pair<long long, long long>> pr;
  while (n--) cin >> b, vec.push_back(b);
  vec2 = vec;
  for (int i = 0; i < vec.size(); i++) {
    mn = vec[i];
    for (int j = i + 1; j < vec.size(); j++) {
      if (vec[j] < mn) mn = vec[j], b = j;
    }
    if (vec[i] != mn) {
      pr.push_back({b, i});
      swap(vec[i], vec[b]);
    }
  }
  cout << pr.size() << endl;
  for (int i = 0; i < pr.size(); i++)
    cout << pr[i].first << "  " << pr[i].second << endl;
}
