#include <iostream>

using namespace std;

int main()
{
    std::ios_base::sync_with_stdio(false);

    int pocet;
    int a1;
    int d;
    int startIndex = 1;
    int prev;
    int curr;

    while(!cin.eof())
    {
        cin >> pocet;

        if(cin.eof())
            break;

        if(pocet != 0 && pocet != 1)
        {
            cin >> prev;
            cin >> curr;
            a1 = prev;
            d = curr - prev;
            for(int i = 2; i < pocet; i++)
            {
                prev = curr;
                cin >> curr;
                if(curr != prev + d)
                {
                    a1 = prev;
                    d = curr - prev;
                    startIndex = i;
                }
            }
        }

        cout << startIndex << endl;
    }


    return 0;
}