#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  int sum = 0;
  for (int i = (0); i < (n); ++i) {
    cin >> a[i].first;
    a[i].second = i;
    sum += a[i].first;
  }
  double ave = sum / n;
  int minimum = INF;
  int ans;
  for (int i = (0); i < (n); ++i) {
    if (abs(ave - a[i].first) < minimum) {
      minimum = abs(ave - a[i].first);
      ans = a[i].second;
    }
  }
  cout << ans << "\n";
  return 0;
}
