#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pl; queue q; int main() { int N; int A[110]; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; } int cnt = 0; for (int i = 1; i < N - 1; i++) { int mx = max(A[i-1],max(A[i],A[i+1])); int mi = min(A[i - 1], min(A[i], A[i + 1])); if (mx == A[i] || mi == A[i]) { cnt++; } } cout << cnt << endl; if (cnt != 0) { for (int i = 0; i A[j]) { swap(A[i], A[j]); cout << i << " " << j << endl; } } } } int damy; cin >> damy; return 0; }