#include <bits/stdc++.h>
using namespace std;
static const int INF = 1000010000;
static const int MOD = 1000000007;
double absd(double a) {
  if (a < 0)
    return -1.0 * a;
  else
    return a;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
    sum += a[i];
  }
  int ave = sum / n;
  int dif = 1000;
  int ans = -1;
  for (int i = 0; i < (n); ++i) {
    if (dif > abs(ave - a[i])) {
      ans = i;
      dif = abs(ave - a[i]);
    }
  }
  cout << ans << endl;
}
