#include <bits/stdc++.h>
const long long modu = 1e9 + 7;
using namespace std;
void a() {
  int n;
  cin >> n;
  vector<int> num(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> num[i];
    sum += num[i];
  }
  double aver = 1.0 * sum / n;
  int ret = 0;
  for (int i = 1; i < n; i++) {
    if (abs(1.0 * num[i] - aver) < abs(1.0 * num[ret] - aver)) ret = i;
  }
  cout << ret;
}
int main() {
  a();
  return 0;
}
