#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll n;
vector<int> a, b;
void input() {
  cin >> n;
  a.resize(n);
  b.resize(n);
  for (ll i = 0; i < (n); ++i) cin >> a[i];
}
void src() {
  input();
  double ave;
  for (ll i = 0; i < (n); ++i) ave += (double)a[i];
  ave /= (double)n;
  for (ll i = 0; i < (n); ++i) b[i] = fabs(a[i] - ave);
  int min = 1000;
  int minid = 0;
  for (ll i = 0; i < (n); ++i)
    if (b[i] < min) {
      min = b[i];
      minid = i;
    }
  cout << minid;
  return;
}
int main(int argc, char* argv[]) {
  src();
  return 0;
}
