#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using namespace std;
bool isPrimeNum(ll x) {
  if (x <= 1) {
    return false;
  }
  int n = (int)sqrt((double)x);
  for (int i = 2; i <= n; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(int a, int b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
  if (a >= b) return a - b;
  if (a < b) return b - a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
  ll N, K;
  cin >> N;
  ll a[N];
  int sum = 0;
  for (int i = (0); i <= (N - 1); i++) {
    cin >> a[i];
    sum = sum + a[i];
  }
  double avg = sum / N;
  double min = 999;
  int ans;
  for (int i = (0); i <= (N - 1); i++) {
    double sabun;
    if (a[i] > avg) {
      sabun = a[i] - avg;
    } else {
      sabun = -a[i] + avg;
    }
    if (min > sabun) {
      min = sabun;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
