#include <bits/stdc++.h>
using namespace std;
struct point {
  int x;
  int y;
};
int i, j, k, count1 = 0, count2 = 0;
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  int sum = 0;
  for (int i = 0; i < (int)(n); i++) {
    cin >> vec[i];
    sum += vec[i];
  }
  double ave = (double)sum / n;
  int ans, minv;
  for (int i = 0; i < (int)(n); i++) {
    if (i == 0) {
      minv = abs(vec[i] - ave);
      ans = i;
    } else if (abs(vec[i] - ave) < minv) {
      minv = abs(vec[i] - ave);
      ans = i;
    }
  }
  cout << ans << endl;
}
