#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n;
  int arr[n], a2[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<int> a, b;
  for (int i = n - 1; i >= 0; i--) {
    if (max_element(arr, arr + i + 1) - arr != i) {
      a.push_back(max_element(arr, arr + i + 1) - arr);
      b.push_back(i);
      swap(arr[max_element(arr, arr + i + 1) - arr], arr[i]);
    }
  }
  cout << a.size() << endl;
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << " " << b[i] << endl;
  }
  return 0;
}
