#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const int mod = 1e9 + 7;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int pct(int x) { return __builtin_popcount(x); }
int bit(int x) { return 31 - __builtin_clz(x); }
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
void DBG() { cerr << "]" << endl; }
template <class H, class... T>
void DBG(H h, T... t) {
  cerr << to_string(h);
  if (sizeof...(t)) cerr << ", ";
  DBG(t...);
}
const int maxn = 1e5 * 3 + 20;
int n, _, q, k;
int a[1000];
int diff[1000];
void solve() {
  cin >> n;
  int sum = 0;
  for (signed i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double avg = sum / (double)n;
  int mind = inf;
  for (signed i = 1; i <= n; i++) {
    diff[i] = abs(a[i] - avg);
    mind = min(mind, diff[i]);
  }
  int ans = -1;
  for (signed i = 1; i <= n; i++) {
    if (diff[i] == mind) {
      ans = i;
      break;
    }
  }
  cout << ans - 1 << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
