main = do
    n <- getLine
    oCards <- getContents
    let cards = map words $ lines oCards
    let taro = (taroWin cards) * 3 + (draw cards)
    let hanako = (hanakoWin cards) * 3 + (draw cards)
    putStrLn $ (show taro) ++ " " ++ (show hanako)

draw :: [[String]] -> Int
draw = length . filter (\ws -> (ws!!0)==(ws!!1))

taroWin :: [[String]] -> Int
taroWin = length . filter (\ws -> (ws!!0)>(ws!!1))

hanakoWin :: [[String]] -> Int
hanakoWin = length . filter (\ws -> (ws!!0)<(ws!!1))
