#include<bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(i=a;i<b;++i) #define FORD(i,a,b) for(i=a;i>=b;--i) #define infi 1000000007 #define pb push_back #define mp make_pair #define ll long long #define MAX 10000005 #define CO 1000000 int n; int inp[500000]; int precom[600005]; int actual[500005]; int tree[MAX], bit1[MAX], bit2[MAX]; int a[200005]; int read(int idx) { int sum = 0; while (idx > 0) { sum += tree[idx]; idx -= (idx & -idx); } return sum; } void update(int idx, int val) { while (idx < MAX) { tree[idx] += val; idx += (idx & -idx); } } void upd1(int idx, int val) { while (idx < MAX) { bit1[idx] += val; idx += (idx & -idx); } } int rd1(int idx) { int retval = 0; while (idx > 0) { retval += bit1[idx]; idx -= (idx & -idx); } return retval; } void upd2(int idx, int val) { while (idx < MAX) { bit2[idx] += val; idx += (idx & -idx); } } int rd2(int idx) { int retval = 0; while (idx > 0) { retval += bit2[idx]; idx -= (idx & -idx); } return retval; } int main() { cin >> n; int i, j, k; int maxx = -1, p = -1; FOR(i, 0, n) cin >> inp[i]; for (i = n-1; i >= 0; i--) { actual[i] = read(inp[i]-1); update(inp[i], 1); if(actual[i] >= maxx) { maxx = actual[i]; p = i; } /*cout << sum << endl; for (int j = 0; j < 5; j++) cout << tree[j] << " "; cout << endl;*/ } /*FOR(i, 0, n) cout << i <<" "<<actual[i] << endl; cout << endl << endl << p << endl;*/ maxx = infi; int po = 0; int tmpans; //cout <<" "<<p << endl; for (i = n-1; i >= p; i--) { upd1(inp[i], 1); } FORD(i, n-1, p+1 ) { int f1 = 0, f2 = 0; swap(inp[p], inp[i]); /*FOR(j, p + 1, n) { if(inp[j] < inp[p]) f1++; }*/ f1 = rd1(inp[p]-1); if(i != n -1) upd2(inp[i + 1], 1); f2 = rd2(inp[i] - 1); /*FOR(j, i + 1, n) { if(inp[j] < inp[i]) f2++; }*/ tmpans = f1 + f2 - actual[p] - actual[i]; /*cout <<i <<" - >>"<<endl; for(int id = 0; id < n ; id++) cout <<" "<< inp[id]; cout << endl; cout << f1 <<" "<<f2 << " "<<tmpans<<endl;*/ if(tmpans <= maxx) { maxx = tmpans; po = i; } swap(inp[p], inp[i]); } if(maxx > 0) cout << "Cool Array"<<endl; else cout << p + 1 <<" "<<po + 1<<endl; return 0; }