#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  vector<long long>(a)((n));
  long long total = 0;
  for (long long i = 0; i < (n); ++i) {
    cin >> a[i];
    total += a[i];
  }
  float x = total / n;
  vector<float> b(n);
  for (long long i = 0; i < (n); ++i) {
    b[i] = abs(a[i] - x);
  }
  sort(b.begin(), b.end());
  for (long long i = 0; i < (n); ++i) {
    float t = abs(a[i] - x);
    if (t == b[0]) {
      cout << i;
      break;
    }
  }
  return 0;
}
