#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans += a[i];
  }
  ans = (double)ans / n;
  int sa = 0, ansans = 0;
  for (int i = 0; i < n; i++) {
    int abc = 0;
    abc = max(a[i], sa) - min(a[i], sa);
    if (sa > abc) {
      sa = abc;
      ansans = i;
    }
    if ((max(a[i], a[i - 1])) == (min(a[i], a[i - 1]))) {
      if (a[i] >= a[i - 1]) {
        ansans = i - 1;
      } else
        ansans = i;
    }
  }
  cout << ansans << endl;
  return 0;
}
