#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  double ave = (double)accumulate(all(A), 0)/n;
  double mn = inf;
  int ans = 0;
  rep(i, n) {
    if(abs(A[i]-ave) < mn) {
      ans = i;
      mn = abs(A[i]-ave);
    }
  }
  cout << ans << "\n";
  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;
}
