import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Ord

main :: IO ()
main = readLn >>= main'
    where
        main' n = readLine >>= print . solve n 

solve :: Int -> [Int] -> Int 
solve n as = fst . head . sortBy cmpf . map mf . zip [0..] $ map fromIntegral as
    where
        avrage = (fromIntegral . sum) as / fromIntegral n
        mf (x, y) = (x, abs $ y - avrage)
        cmpf lhs rhs = comparing snd lhs rhs `mappend` comparing fst lhs rhs

readLine :: IO [Int]
readLine = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine