#include <bits/stdc++.h>
using namespace std;
static const long long maxLL = (long long)1 << 62;
const long long MOD = 1000000007;
const long long INF = 1e18;
int ca[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int i, j, n, d, k, cnt = 0;
  string s;
  vector<double> list;
  double sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    sum += num;
    list.push_back(num);
  }
  double avg = (double)sum / (double)n;
  int index = 0;
  double minn = 9999999;
  for (int i = 0; i < n; i++) {
    if (minn > abs(avg - list[i])) {
      minn = abs(avg - list[i]);
      index = i;
    }
  }
  cout << index << endl;
  getchar();
  getchar();
  return 0;
}
