#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> a(N, 0);
  for (int i = 0; i < (N); ++i) {
    cin >> a[i];
  }
  int sum = 0;
  for (int i = 0; i < (N); ++i) {
    a[i] *= 2;
    sum += a[i];
  }
  sum /= N;
  int res = -1;
  int ans = ((int)(1e9));
  for (int i = 0; i < (N); ++i) {
    int curr = abs(a[i] - sum);
    if (curr < ans) {
      ans = curr;
      res = i;
    }
  }
  cout << res << endl;
  return 0;
}
