DBG = !true
n = gets.to_i
a = gets.split.map{|x| x.to_i}

sum = 0
for i in 0...n
  sum += a[i]
end

mindif = 99999
minsuf = 999
for i in 0...n
  if (a[i]*n - sum).abs < mindif
    mindif = (a[i]*n - sum).abs
    minsuf = i
  end
end
print minsuf
