#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long MOD = 1e9 + 7;
long long gcd(long long x, long long y) {
  if (y == 0) return 0;
  return gcd(y, x % y);
}
int dis2(int x1, int y1, int x2, int y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
int main() {
  int n;
  cin >> n;
  int a[n];
  double avg = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    avg += a[i];
  }
  avg /= (double)n;
  int sub = INF;
  int ans = -1;
  for (int i = 0; i < n; i++) {
    if (sub > abs(a[i] - avg)) {
      sub = abs(a[i] - avg);
      ans = i;
    }
  }
  cout << ans << endl;
}
