#include <bits/stdc++.h>
using namespace std;

long long int MOD=1000000007; //998244353
long long int inverse(long long int i){
    if(i==1) return 1;
    return (MOD - ((MOD/i)*inverse(MOD%i))%MOD+MOD)%MOD;
}
vector<vector<int>> edges (501);
void dfs(int root,vector<int> &visited)
{
    visited[root]=1;
    for(int i=0;i<edges[root].size();++i)
    {
        if(visited[edges[root][i]]==0)
        {
            dfs(edges[root][i],visited);
        }
    }
}
int main()
{int n;
cin >> n;

vector<int> taken(n,0),k(n),k1(n);
for(int i=0;i<n;++i)
{
    cin >> k[i];
    k1[i]=k[i];
}
/*for(int i=0;i<(n*(n-1))/2;++i)
{
    int x,y;
    cin >> x>> y;
    k[y-1]++;
    k1[y-1]++;
}*/


vector<pair<int,int>> v1;
for(int i=0;i<n;++i)
v1.push_back({k[i],i});

for(int i=n;i>=2;--i)
{
    sort(v1.begin(),v1.end());

    

    int r=i-1;
    int p2=v1[r].first,p3=v1[r].second;
    taken[p3]=1;



    for(int s=0;s<p2;++s)
        edges[v1[s].second].push_back(p3);
    for(int s=p2;s<r;++s)
    {
    edges[p3].push_back(v1[s].second);
    k[v1[s].second]--;
    }
    v1.clear();
    for(int s=0;s<n;++s)
    {
        if(taken[s]==0)
        {
            v1.push_back({k[s],s});
        }
    }

}
vector<int> visited(n,0);
int reachable[n][n];
for (int i=0;i<n;++i)
{
    dfs(i,visited);
    for(int j=0;j<n;++j)
       {

        reachable[i][j]=visited[j];
        visited[j]=0;}

}
int ans1=0,a1=-1,a2=-1;
for(int i=0;i<n;++i)
{
    for(int j=0;j<n;++j)
    {
        if(i!=j&&reachable[i][j]==1&&reachable[j][i]==1)
        {
            if(abs(k1[i]-k1[j])>=ans1)
            {
                ans1=abs(k1[i]-k1[j]);
                a1=i;
                a2=j;
            }
        }
    }
}
cout<<"! "<<a1+1<<" "<<a2+1;

}
