#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);
int main() {
  cin.sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (int)(N); i++) cin >> a[i];
  double mid = 0;
  for (int i = 0; i < (int)(N); i++) {
    mid += a[i];
  }
  mid /= N;
  int ans = 0, minv = 100000;
  for (int i = 0; i < (int)(N); i++) {
    if (minv > abs(mid - a[i])) {
      ans = i;
      minv = abs(mid - a[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
