#include <bits/stdc++.h>
template <class T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> a[i];
  double mean = 0;
  for (long long i = 0; i < (long long)(n); i++) mean += a[i];
  mean /= n;
  double d = 1e9;
  for (long long i = 0; i < (long long)(n); i++) chmin(d, a[i] - mean);
  for (long long i = 0; i < (long long)(n); i++) {
    if (d == a[i] - mean) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}
