#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < (n); ++i) cin >> a[i];
  int sum = 0;
  for (int i = 0; i < (n); ++i) sum += a[i];
  double ave = sum / n;
  int id = 0;
  double d = INF;
  for (int i = 0; i < (n); ++i) {
    double dis = abs((double)(a[i]) - ave);
    if (dis < d) {
      d = dis;
      id = i;
    }
  }
  cout << id << endl;
  return 0;
}
