function Main(input) {
  const args = input.split('\n');
  const N = parseInt(args[0], 10),
    a = args[1].split(' ').map(n => parseInt(n, 10));

  const aver = a.reduce((p, c) => p + c) / a.length;
  var diff = [];
  var index = 0;

  a.forEach((val, i) => {
    diff[i] = Math.abs(aver - val);
    index = diff[index] <= diff[i] ? index : i;
  });
  console.log(index);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));