N = gets.to_i
a = gets.chomp.split(" ").map(&:to_i);
sum = 0

a.each do |i|
  sum += i
end
average = sum / N

thumbnail = a[0]
ans = 0

N.times do |i|
  if (average - a[i]).abs < (average - thumbnail).abs
    thumbnail = a[i]
    ans = i
  end   
end
puts ans