#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, res = 0;
  cin >> n;
  double a[n];
  double sum = 0.0, ans = 1000.0;
  for (int i = 0; i < n; i++) cin >> a[i], sum += a[i];
  sum /= n;
  for (int i = 0; i < n; i++) {
    int dis = abs(a[i] - sum);
    if (dis < ans) {
      ans = dis;
      res = i;
    }
  }
  cout << res << endl;
  return 0;
}
