#include <bits/stdc++.h> using namespace std; /* macros */ // memory #define zeroset(A) memset((A), 0, sizeof((A))) #define negset(A) memset((A), -1, sizeof((A))) #define all(c) (c).begin(), (c).end() #define pb push_back // for loops #define forlop(i,n) for (int i=0; i<n; i++) #define forlp(i,start,n) for (int i=start; i<n; i++) #define forone(i,n) for (int i=1; i<n; i++) #define iter(c,it) for (typeof((c).begin()) it = (c).begin(); it!=(c).end(); it++) #define iterf(c,bg,it) for (typeof((c).begin()) it = bg; it!=(c).end(); it++) #define riter(c,it) for (typeof((c).rbegin()) it = (c).rbegin(); it!=(c).rend(); it++) // input & output #define intscan(d) scanf("%d", &d) #define llscan(d) scanf("%lld", &d) #define dscan(d) scanf("%lf", &d) #define fast ios::sync_with_stdio(false) #define inpt(a) freopen(a,"r",stdin) #define otpt(a) freopen(a,"w",stdout) #define eol "\n" // types typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<double, double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vector<ll> > matrix; #define ff first #define ss second #define mp make_pair // constants #define EPS 1e-9 #define MAXN 100005 #define MAXB 1000001 #define INF INT_MAX #define NINF INT_MIN #define MOD 1000000007 vi arr; int BST[MAXB], b[MAXB]; int cnt[MAXB]; int n; vi minv; int maxi, mini; void add(int *B, int i, int v){ for(; i<MAXB; i+=(i&(-i))) B[i]+=v; } int _get(int *B, int i){ int s=0; for(; i>0; i-=(i&(-i))) s+=B[i]; return s; } int get(int *B, int f, int t){ return _get(B, t)-_get(B, f-1); } void max_min(){ maxi=n-1, mini; forlop(i,n) add(BST, arr[i], 1); for(int i=n-1; i>=0; --i){ add(BST, arr[i], -1); cnt[i] = get(BST, arr[i], MAXB-2); if(cnt[maxi]<=cnt[i]) maxi=i; } mini = cnt[maxi]; forlop(i,maxi) mini = min(mini,cnt[i]); } void count_in_init(){ forlop(i,n) add(b, arr[i], 1); for(int i=n-1; i>=maxi; --i) add(b, arr[i], -1); } int count_in(int i){ int smallerThanMaxi = _get(b, arr[maxi]-1); int smallerThani = _get(b,arr[i]-1); return smallerThanMaxi - smallerThani; } int main() { fast; cin >> n; bool flag= true; forlop(i,n){ int x; cin >> x; flag = flag && (x==i+1); arr.pb(x); } if(flag){ cout << "Cool Array\n"; return 0;} max_min(); count_in_init(); set<pair<int,pii> > ans; forlop(i,maxi){ add(b,arr[i],-1); if(cnt[i]==mini&&arr[i]>arr[maxi]){ int c = count_in(i); ans.insert(mp(c,mp(i+1,maxi+1))); } } pair<int,pii> p = *(ans.begin()); cout << p.ss.ff << " " << p.ss.ss << eol; // iter(ans,pp) { pair<int,pii> p = *pp;cout<<"("<<p.ff<<" "<<p.ss.ff<<" "<<p.ss.ss<<"), ";} return 0; }