<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($N,$M) = explode(" ",trim(fgets(STDIN)));
$a = explode(" ",trim(fgets(STDIN)));
//$H = explode(" ",trim(fgets(STDIN)));

$avg = array_sum($a)/count($a);

foreach($a as $k=>$v) {
   $diff[]=abs($v - $avg);
}
asort($diff);
foreach($diff as $k=>$v) {
  printf("%d\n",$k);
  exit;
}
