import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto n = lread();
    auto a = aryread();
    long sum_a;
    foreach (i; 0 .. a.length)
    {
        sum_a += a[i];
    }
    // writeln(sum_a);
    // writeln(cast(double) sum_a / a.length);
    auto tmp = cast(double) sum_a / a.length;
    auto ans = new double[](a.length);
    foreach (i; 0 .. a.length)
    {
        // writeln(abs(a[i] - tmp));
        ans[i] = abs(a[i] - tmp);
    }
    // writeln(ans);
    long ansans;
    auto min_x = double.max;
    foreach (i; 0 .. ans.length)
    {
        if (min_x > ans[i])
        {
            min_x = ans[i];
            ansans = i;
        }
    }
    writeln(ansans);
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
