#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> v(n + 1);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  double ave = sum / n;
  int ans = INF;
  int pos;
  for (int i = 0; i < n; i++) {
    double tmp = abs(v[i] - ave);
    if (tmp < ans) {
      ans = tmp;
      pos = i;
    }
  }
  cout << pos << endl;
  return 0;
}
