n = gets.to_i
a = gets.split.map(&:to_f)
b = a.inject(:+)/n
for i in 0..n-1
    a[i] -= b
    a[i] = [a[i].abs,i]
end
a = a.sort_by{|i,j|i}
ans = a[0]

for i in 0..n-1
    if ans[0] < a[i][0]
        break
    elsif ans[1] > a[i][1]
        ans = a[i]
    end
end
puts ans[1]