#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, sum, ans, max = 100000;
  cin >> n;
  vector<int> a(n), b(n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  for (i = 0; i < n; i++) {
    sum = 0;
    for (j = 0; j < n; j++) {
      b[j] = a[j] - a[i];
      sum += abs(b[j]);
    }
    if (sum < max) {
      max = sum;
      ans = i;
    }
  }
  cout << ans << endl;
}
