#include <iostream>
#include <vector>

using namespace std;

int main(){
  int N; cin >> N;
  vector<int> a(N);
  for(auto& t : a) cin >> t;
  int sum = 0;
  for(auto& t : a) sum += t;
  int res = 0, dif = 1000000000;
  for(int i=0;i<N;i++){
    int sub = abs(sum - N * a[i]);
    if(sub < dif){ res = i; dif = sub; }
  }
  cout << res << endl;
}