#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  double ave = 0;
  cin >> n;
  set<int> st;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> a;
    ave += a;
    if (st.find(a) == st.end()) {
      mp[a] = i;
    }
    st.insert(a);
  }
  ave /= n;
  double min = 99999999;
  int num1, num2;
  bool flag = true;
  for (auto itr = st.begin(); itr != st.end(); itr++) {
    double temp = abs(*itr - ave);
    if (temp < min) {
      num1 = *itr;
      min = temp;
    }
    if (temp == min) {
      num2 = *itr;
      flag = false;
    }
  }
  if (flag) {
    cout << mp[num1] << endl;
  } else {
    int a = mp[num1];
    int b = mp[num2];
    if (a > b) a = b;
    cout << a << endl;
  }
  return 0;
}
