#include <bits/stdc++.h>
using namespace std;
int n, a[105];
int main() {
    scanf("%d", &n);
    double s = 0;
    for (int i = 0; i < n; i++) scanf("%d", &a[i]), s += a[i];
    s /= n;
    int ans = 0;
    for (int i = 1; i < n; i++)
        if (fabs(a[ans]-s) > fabs(a[i]-s)) ans = i;
    printf("%d\n", ans);
}
