#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 andis1 = 0;
    for ( int i = 1 ; i < n ; i ++ )
    {
        if ( arr[i] == arr[andis1] )
        {
            andis1 = i;
        }
    }

    if ( andis1 == 0 )
    {
        int andis2 = 1;
        int ekhtelaf = arr[andis1] - arr[andis2];
    }

    else
    {
        int andis2 = 0;
        int ekhtelaf = arr[andis1] - arr[andis2];
    }


    for ( int i = 0 ; i < n ; i ++ )
    {
        if ( i != andis1 && (arr[andis1] - arr[i]) > ekhtelaf )
        {
           ekhtelaf = arr[andis1] - arr[i];
        }

    }

    for ( int i = 0 ; i < n ; i ++ )
    {
        if ( arr[andis1] - ekhtelaf == arr[i] )
        {
            andis2 = i;
            cout << abs(andis1 - andis2);
        }
    }

    return 0;
}