import Data.List
import Data.Function

main :: IO ()
main = do
 n <- read <$> getLine :: IO Int 
 as <- map read . words  <$> getLine :: IO [Int]
 let ias = zip [0..] as
     summed = sum as
     ans = minimumBy (compare `on` snd)
       $ map (\(i, a) -> (i, abs (a*n-summed))) ias
 putStrLn $ show $ fst ans