#include <bits/stdc++.h>
using namespace std;
long long fastpow(long long a, long long b) {
  if (b == 0) return 1LL;
  long long temp = fastpow(a, b / 2);
  temp = temp * temp;
  if (b % 2 == 1) temp = temp * a;
  return temp;
}
void solve() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  double v[n];
  double avg = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    avg += v[i];
  }
  avg /= n;
  long long ans = 0, mini = fabs(v[0] - avg);
  for (int i = 1; i < n; i++) {
    if (fabs(v[i] - avg) < mini) {
      mini = fabs(v[i] - avg);
      ans = i;
    }
  }
  cout << ans;
  return 0;
}
