#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i=0;i<n;i++) cin >> v[i];
    int S = 0;
    for (int i=0;i<n;i++) S += v[i];
    vector<pair<int, int> > a;
    for (int i=0;i<n;i++) a.push_back(make_pair(abs(S-v[i]*n), i));
    sort(a.begin(), a.end());
    cout << a[0].second;


}
