#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = (double)sum / n;
  int ans = 0;
  for (int j = 0; j < n; j++) {
    b[j] = abs(ave - a[j]);
  }
  sort(b.begin(), b.end());
  for (int i = 0; i < n; i++) {
    if (abs(ave - a[i]) == b[0]) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
