import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V
import           Data.Char
import           Data.Ratio

readIntN :: Int -> IO (V.Vector Int)
readIntN n = V.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine

main :: IO ()
main = do
  n <- readLn
  as <- readIntN n
  print $ solve n as

solve :: Int -> V.Vector Int -> Int
solve n as = V.head $ V.elemIndices True _idx
  where
    _ave = (V.sum as) % n
    _abs = V.map abs $ V.map (\a -> (a % 1) - _ave) as
    _min = V.minimum _abs
    _idx = V.map ((==) _min) _abs
