#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int i, j, k; int n; vectora, b; vector>reki(0, vector(2)); cin >> n; for (i = 0; i < n; i++) { int num; cin >> num; a.push_back(num); b.push_back(num); } int mainasu; cin >> mainasu; sort(b.begin(), b.end()); int u, v; for (i = 0; i < b.size(); i++) { u = i; if (b[i] != a[i]) { for (j = i; j < a.size(); j++) { if (a[j] == b[i]) { v = j; int tmp = a[u]; a[u] = a[v]; a[v] = tmp; reki.push_back({u, v}); break; } } } } cout << reki.size() << endl; for (i = 0; i < reki.size(); i++) { cout << reki[i][0] << " " << reki[i][1] << endl; } getchar(); getchar(); return 0; }