points :: [String] -> (Int, Int)
points [s1, s2]
  | s1 > s2   = (3, 0)
  | s1 < s2   = (0, 3)
  | otherwise = (1, 1)

addPoints :: (Int, Int) -> (Int, Int) -> (Int, Int)
addPoints (x, y) (x', y') = (x+x', y+y')

sumPoints :: [[String]] -> (Int, Int)
sumPoints = foldl (\a b -> addPoints a $ points b) (0, 0)

main :: IO ()
main = do
    points <- getLine >> getContents >>= return . sumPoints . map words . lines
    putStrLn $ show (fst points) ++ " " ++ show (snd points)
