#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <cstring> #define pb push_back #define mp make_pair using namespace std; int a[1000005]; int b[10005][10005]; vector<pair<int,int> > A, B; int sol(int x, int y) { int s = 0; for (int i = x + 1; i < y; i++){ if (a[i] < a[x]) s--; else s++; if (a[i] > a[y]) s--; else s++; } return s; } bool cmp(pair<int,int> a, pair<int,int> b){ if (a.first != b.first) return a.first > b.first; return a.second < b.second; } int main() { int n, X, Y, i, j, x, s, ma, y, xx, yy, p, k; scanf("%d",&n); for (i = 0; i < n; i++){ scanf("%d",&a[i]); a[i] --; } // printf("%d %d\n", sol(0, 5), sol(1, 5)); for (i = 1; i < n; i++) if (a[i] < a[i - 1]) break; if (i == n) {printf("Cool Array\n"); return 0;} x = 0; ma = -1; for (i = 0; i < n; i++) if (a[i] - i > ma) { A.pb(mp(a[i] - i, i)); //ma = a[i] - i; x = i; } k = 50; y = n - 1; ma = -1; for (i = 0; i < n; i++) if (i - a[i] > ma) { B.pb(mp(i - a[i], i)); //ma = i - a[i]; y = i; } sort(A.begin(), A.end(), cmp); sort(B.begin(), B.end(), cmp); ma = n * n; for (i = 0; i < A.size() && i < 40; i++) for (j = 0; j < B.size() && j < 40; j++) if (a[A[i].second] > a[B[j].second]) { p = sol(A[i].second, B[j].second); if (p < ma){ ma = p; x = A[i].second; y = B[j].second; } } printf("%d %d\n", x + 1, y + 1); return 0; }