#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  float ave = sum / n;
  float min = 1000000000;
  int ans;
  for (int i = 0; i < n; i++) {
    if (min > abs(a[i] - ave)) {
      min = abs(a[i] - ave);
      ans = i;
    }
  }
  cout << ans << endl;
}
