import Data.List (sort)

main = do
  a <- fmap read getLine
  b <- fmap words getLine
  let bs = map (read :: String -> Float) b
  let bb = (sum bs) / a
  let sb = sort bs
  let st = last (filter (<= a) sb)
  let gt = head (dropWhile (> a) sb)
  if ((abs $ bb - st) > (abs $ bb - gt)) 
  then print $ numb bs gt
  else if ((abs $ bb - st) == (abs $ bb - gt)) 
  then print $ numb2 bs gt st
  else print $ numb bs st
  
numb :: [Float] -> Float -> Int
numb (x:xs) n = if x == n then 0 else 1 + numb xs n
numb []     n = 0

numb2 :: [Float] -> Float -> Float -> Int
numb2 (x:xs) n m = if x == n || x == m then 0 else 1 + numb2 xs n m
numb2 []     n m = 0