module practiceA
  sub Main()
    dim intNum as integer
    dim i as integer
    dim intAns as integer
    dim intAns2 as Double
    dim intAns3 as integer
    dim blnAns  as boolean
Dim line As String
Dim data() As String
Dim data2be As Double
Dim data2af As Double

    intNum =Console.ReadLine()
    line = Console.ReadLine()
        data = Split(line, " ")

    for i = 0 to intNum  -1
    intAns = intAns + CInt(data(i).Trim())
    next i

    intAns2  = intAns / intNum  '平均

    blnAns   = false
    for i = 0 to intNum  -1
    if (data(i) = intAns2) then
      intAns3 = i
    blnAns   = true

    Console.Write(intAns3 )
      exit for
    end if
    next i

    if     blnAns   = false then
      data2be = 0
      data2af = 999
    for i = 0 to intNum  -1
      data2be =   Math.Abs(data(i) - intAns2)
      if data2af > data2be then
        data2af  = data2be 
      end if
    next i
   
    for i = 0 to intNum  -1
'    Console.Write(data(i) & " " &  intAns2 & " " & data2af & vbCrLf )

    if ((data(i) = (intAns2 - data2af)) or (data(i) = (intAns2 + data2af))) then
      intAns3 = i
    Console.Write(intAns3 )
      exit for
    end if
     
    next i


    ' Console.Write(data2af  )
    end if
  end sub
end module