#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 max1 = arr[0];
int andis1 = 0;
for ( int b = 1 ; b < n ; b ++ )
{
if ( arr[b] > max1 )
{
max1 = arr[b];
andis1 = b;
}
}
int max2 = arr[0];
int andis2 = 0;
int k = abs(max1 - max2);
for ( int c = 0 ; c < n ; c ++ )
{
if ( (max1 - arr[c]) < k )
{
max2 = arr[c];
andis2 = c;
}
k = abs(max1 - max2);
}
cout << abs(andis1 - andis2);
return 0;
}