import           Control.Applicative
import           Data.List

point :: String -> String -> (Int, Int)
point xs ys
    | xs < ys = (0, 3)
    | xs > ys = (3, 0)
    | otherwise = (1, 1)

addPair :: (Int, Int) -> (Int, Int) -> (Int, Int)
addPair (a,b) (c,d) = (a + c, b + d)

main :: IO ()
main = do
    getLine
    xss <- fmap words . lines <$> getContents
    let (taro, hanako) =
            foldr (\[as, bs] acc -> (point as bs) `addPair` acc) (0, 0) xss
    putStrLn $ show taro ++ " " ++ show hanako

