          #include<bits/stdc++.h>
           
          using namespace std;
           
          #define FOR(i,a,b) for(int i = (a); i < (b); i++)
          #define RFOR(i,a,b) for(int i = (a) - 1; i>=(b);i--)
          #define rep(i,n) FOR(i,0,n)
          #define PB push_back
          #define SZ(a) (int)a.size()
          #define ALL(a) a.begin(), a.end()
          #define FILL(a, value) memset(a, value, sizeof(a))
          #define IOS ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0);
           
           
          typedef  long long LL ;
          typedef  vector<int > VI ;
          typedef vector<LL > VL;
          typedef pair<int,int > PII;
          typedef pair<LL,LL> PLL;
           
          const LL LINF = (LL)1e18 +47;
          const int INF =  (int)1e9 + 47 ;
          const int MOD =(int)1e9 + 7 ;
          const int modulo = 998244353;
          const int nax =  7*(int)1e5;
          const double EPS = 1e-7;
          const double PI = acos(-1.0);
             
           
          PII k[nax]; 
          int main()
          {
             #ifndef ONLINE_JUDGE
            freopen("input.txt", "r", stdin);                               
            freopen("output.txt", "w", stdout);
            #endif
            IOS;
            int n;
            cin>>n;
            rep(i,n)cin>>k[i].first; 
            rep(i,n)k[i].second = i;
            sort(k,k + n); 
            int cur=0;
            int last=0;
            PII ans={0,0};
            int res=-1;
            rep(i,n){
                cur+=k[i].first-(i +1 ) +1;
                if(cur==0){
                    if(last!=i){
                        int v=k[i].first-k[last].first;
                        if(v>res){
                            res=v;
                            ans={k[i].second + 1,k[last].second + 1};
                        }
                    }
                    last=i+1;
                }
            }
            cout<<"! "<<ans.first<<' '<<ans.second;
          }     
