#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll MAX = 1e6 + 10, intINF = 1e9 + 100;
int func() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<pair<int, int>> answer;
  int n = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < (n); i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int j = i;
    for (int t = i; t < n; t++)
      if (a[j] > a[t]) j = t;
    if (i != j) answer.push_back(make_pair(i, j));
    swap(a[i], a[j]);
  }
  cout << answer.size() << '\n';
  for (int i = 0; i < answer.size(); i++)
    cout << answer[i].first << " " << answer[i].second << '\n';
}
