#include <bits/stdc++.h>
using namespace std;
const long long int MAX_N = 1 << 17;
using namespace std;
signed main() {
  long long int n;
  std::cin >> n;
  std::vector<long double> a(n, 0);
  long double mean;
  for (long long int i = 0; i < n; i++) {
    long double temp;
    std::cin >> temp;
    a[i] = temp;
    mean += temp;
  }
  mean = (long double)mean / ((long double)n * 1.0);
  long double min = 1000000.00;
  long double flag = 0;
  for (long long int i = 0; i < n; i++) {
    if (abs(a[i] - mean) < min) {
      min = abs(a[i] - mean);
      flag = i;
    }
  }
  std::cout << flag << std::endl;
  return 0;
}
