<?php
// 標準入力から取得
class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}
 
class SubmitAnswer {
    public static function println($answer = "") {
        echo $answer . PHP_EOL;
    }
}
 
$sc = new Scanner();
$n = $sc->nextInt();
$minDelta = $n;
$array = [];
 
for ($i=0;$i<$n;$i++) {
    $array[] = $sc->nextInt();
}
 
$average = array_sum($array) / count($array);
$arrayReversed = array_reverse($array);
 
for ($i=0;$i<100;$i++) {
    if (abs($arrayReversed[$i] - $average)) <= $minDelta){
        $answer = $n - $i -1;
        $minDelta = abs($arrayReversed[$i] - $average);
    }
}
 
SubmitAnswer::println("$answer");