N = gets.to_i
A = gets.split(' ').map(&:to_i)

average = A.inject(0){|s, a| s + a } / N
diff = A.map{|a| (a-average).abs}.sort[0]
warn average
warn diff
puts A.find_index{|a| (a - average).abs == diff}