#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const int INF = 1 << 25;
template <typename T>
T gcd(T a, T b) {
  if (a > b) return gcd(b, a);
  return a == 0 ? b : gcd(b % a, a);
}
template <typename T, typename U>
T mypow(T b, U n) {
  if (n == 0) return 1;
  if (n == 1) return b;
  if (n % 2 == 0) {
    return mypow(b * b, n / 2);
  } else {
    return mypow(b, n - 1) * b;
  }
}
int main() {
  int N;
  cin >> N;
  int a[N];
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  int target = sum / N;
  int ret = -1;
  int diff = INF;
  for (int i = 0; i < N; i++) {
    if (abs(a[i] - target) < diff) {
      diff = abs(a[i] - target);
      ret = i;
    }
  }
  cout << ret << endl;
  return 0;
}
