import Control.Applicative import Control.Monad import qualified Data.ByteString.Char8 as B import Data.Maybe (fromJust) import Data.List import Text.Printf import Debug.Trace -- or readInteger readInts :: B.ByteString -> [Int] readInts = map (fst . fromJust . B.readInt) . B.words getInts :: IO [Int] getInts = liftM readInts B.getLine main = do [n] <- getInts xs <- getInts print $ solve $ Data.List.sort xs where solve xs = sub xs 0 2 sub [] _ c = to c sub (x:xs) a c = if x == a then sub xs a (c+1) else to c + sub xs x 1 to c = if c > 1 then 0 else 1