import Control.Applicative import Control.Monad import Data.List f ds = sum (map (`div`2) ss) + div (sum $ map (`mod`2) ss) 4 where ss = map length $ group $ sort ds main = readLn >>= flip replicateM (words <$> getLine) >>= print . f . concat