#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
int main() {
  int n;
  cin >> n;
  int a[n];
  double ans = 0;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
    ans += a[i];
  }
  double some = ans / n;
  int min1 = INF, index = 0;
  for (int i = 0; i < (n); ++i) {
    if (min1 > abs(a[i] - some)) {
      min1 = abs(a[i] - some);
      index = i;
    }
  }
  cout << (index) << endl;
  return 0;
}
