#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n; cin >> n; vector a(n); rep(i, n) cin >> a[i]; vector> ans; rep(i, n) { int minim = i; for (int j = i; j < n; ++j) { if (a[j] < a[minim]) minim = j; } if (i != minim) { swap(a[i], a[minim]); ans.push_back({ i, minim }); } } assert(is_sorted(a.begin(), a.end())); cout << ans.size() << endl; for (auto [x, y] : ans) { cout << x << ' ' << y << endl; } int dummy; cin >> dummy; return 0; }