input = require('fs').readFileSync('/dev/stdin', 'utf8');
avr = (a=input.split('\n')[1].split(' ')).map(Number).reduce((x,y)=>x+y)/a.length;
i = -1; min = Infinity;a.map((x, y) => {if (Math.abs(x - avr) < min) {min = Math.abs(x - avr); i = y;}});
console.log(i);