#include <bits/stdc++.h>
using namespace std;

int N, ans, a[100];
double ave;

int main()
{
    scanf("%d", &N);
    for (int i = 0; i < N; i++) scanf("%d", a + i);
    for (int i = 0; i < N; i++) ave += a[i];
    ave /= N;
    ans = 0;
    for (int i = 1; i < N; i++) if ((a[i] - ave)*(a[i] - ave) < (a[ans] - ave)*(a[ans]-ave)) ans = i;
    printf("%d\n", ans);
    return 0;
}
