#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<int> a;
  vector<pair<int, int>> result;
  cin >> n;
  std::copy_n(istream_iterator<int>(cin), n, back_inserter(a));
  for (int i = 0; i < a.size() - 1; ++i) {
    auto it = std::min_element(a.begin() + i, a.end());
    if (distance(a.begin() + i, it)) {
      result.emplace_back(make_pair(i, distance(a.begin(), it)));
      std::iter_swap(a.begin() + i, it);
    }
  }
  cout << result.size() << endl;
  for (const auto& p : result) {
    cout << p.first << " " << p.second << endl;
  }
  return 0;
}
