#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N;
    cin >> N;
    vector<double> a(N);
    REP(i,N) cin >> a[i];

    double av = accumulate(ALL(a),double(0))/N;
    int ans  = 0;
    double shortest = INF;
    REP(i,N) {
        if (chmin(shortest,abs(av-a[i]))) {
            ans = i;
        }
    }

    cout << ans << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main(){
    int N;
    cin >> N;
    int sum = 0;
    double ave = 0;
    double mini = 100;
    double aa = 0;
    int ans = 0;
    vector<int> a(N);
    for(int i = 0;i < N;i++){
        cin >> a.at(i);
        sum += a.at(i);
    }
    ave =  (double)sum/(double)N;
    /*cout << ave << endl;*/

    for(int i = 0;i < N;i++){
        aa = abs(ave - a.at(i));
        if(mini > aa){
            mini = aa;
            
            ans = i;
        }
    }
    cout << ans << endl;
}
