#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> lhs, pair<int, int> rhs) {
  if (lhs.second == rhs.second) {
    return lhs.first < rhs.first;
  }
  return lhs.second < rhs.second;
}
int N;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  vector<pair<int, int> > a_i_num;
  int tempNum;
  pair<int, int> tempPair;
  int sum_a = 0;
  for (int i = 0; i < (N); i++) {
    cin >> tempNum;
    sum_a += tempNum;
    tempPair.first = i;
    tempPair.second = tempNum;
    a_i_num.push_back(tempPair);
  }
  int ave_a = sum_a / a_i_num.size();
  for (int i = 0; i < (N); i++) {
    a_i_num[i].second = abs(a_i_num[i].second - ave_a);
  }
  sort((a_i_num).begin(), (a_i_num).end(), cmp);
  cout << a_i_num[0].first << endl;
  return 0;
}
