#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}
long long int gcd(long long int m, long long int n) {
  if ((0 == m) || (0 == n)) return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}
long long int lcm(long long int m, long long int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int main() {
  int n;
  int a[n], total = 0;
  cin >> n;
  for (int i = 0, i_len = (n); i < i_len; ++i) {
    cin >> a[i];
    total += a[i];
  }
  double ave = total / n;
  double diff = 1145141919;
  double res;
  int ans = 0;
  for (int i = 0, i_len = (n); i < i_len; ++i) {
    res = fabs(a[i] - ave);
    if (res < diff) {
      diff = res;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
