#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int sum = 0;
  int a[101];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  double av = sum / n;
  int ans;
  double dif = 10000;
  for (int i = n - 1; i >= 0; --i) {
    if (abs(a[i] - av) <= dif) {
      ans = i;
      dif = abs(a[i] - av);
    }
  }
  cout << ans << endl;
  return 0;
}
