#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[n];
for ( int i = 0 ; i < n ; i ++ )
{
cin >> arr[i];
}
int max = arr[0];
for ( int b = 1 ; b < n ; b ++ )
{
if ( arr[b] > max )
{
max = arr[b];
}
}
int sum = max - arr[0];
for ( int c = 0 ; c < n ; c ++ )
{
if ( arr[c] != max && (max - arr[c]) > sum )
{
sum = max - arr[c];
}
}
for ( int x = 0 ; x < n ; x ++ )
{
if ( arr[x] == max - sum )
{
cout << x;
}
}
return 0;
}