#include <bits/stdc++.h>

int main()
{
    int n, a[100], sum{}, thumnail{};
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", a + i);
        sum += a[i];
        a[i] *= n;
    }
    for (int i = 0; i < n; i++)
    {
        if (std::abs(a[i] - sum) < std::abs(a[thumnail] - sum)) thumnail = i;
    }
    printf("%d\n", thumnail);

    return 0;
}