#include #include using namespace std; using ll = int64_t; void solve() { int n; cin >> n; vector a(n); for (auto& v : a) { cin >> v; } int ans = 0; vector> ops; for (int i = 0; i + 1 < n; i++) { int offset = i; for (int j = i + 1; j < n; j++) { if (a[j] < a[offset]) { offset = j; } } if (offset != i) { swap(a[i], a[offset]); ops.emplace_back(i, offset); } } cout << ops.size() << '\n'; for (auto& [i, j] : ops) { cout << i << " " << j << '\n'; } int dummy; cin >> dummy; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T = 1; while (T--) { solve(); } return 0; }