#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (int)(N); i++) cin >> a[i];
  int ave = 0;
  for (int i = 0; i < (int)(N); i++) {
    ave += a[i];
  }
  ave /= N;
  int dist = 1e9, ans = 0;
  for (int i = 0; i < (int)(N); i++) {
    int tmp = abs(ave - a[i]);
    if (tmp < dist) {
      dist = tmp;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
