import Control.Monad import Data.List hasDups :: Eq a => [a] -> Bool hasDups (a:b:cs) | a == b = True | otherwise = hasDups (b:cs) hasDups _ = False main :: IO () main = do input <- liftM (map words . lines) (readFile "4.in") print $ sum $ map (fromEnum . not . hasDups . sort) input print $ sum $ map (fromEnum . not . hasDups . sort . map sort) input