#include #include #include using namespace std; typedef pair PII; const int N = 110; int n, a[N], ans; vector moves; int main() { // freopen("no.in", "r", stdin); // freopen("no.out", "w", stdout); scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); int x; scanf("%d", &x); for (int i = 2; i <= n - 1; ++i) { if ((a[i - 1] > a[i] && a[i] < a[i + 1]) || (a[i - 1] < a[i] && a[i] > a[i + 1])) { ++ans; moves.push_back({ i, i + 1 }); swap(a[i], a[i + 1]); } } printf("%d\n", ans); for (int i = 0; i < ans; ++i) { printf("%d %d\n", moves[i].first, moves[i].second); } return 0; }