program speedrun
  implicit none
  integer::N
  integer,allocatable,dimension(:)::a
  integer::ANS
  real(8)::AVE,L
  integer::i
  read*,N
  allocate(a(N))
  read*,a
  AVE=real(SUM(A))/real(N)
  L=huge(L)
  do i=N,1,-1
    if(ABS(A(i)-AVE)<=L)then
        ANS=i-1
        L=ABS(A(i)-AVE)
    endif
end do
print"(i0)",ANS
end program speedrun