main = do
  _ <- getLine
  s <- getContents
  let ss = map words . lines $ s
  let [taro,hana] = solve ss
  putStrLn $ (show taro) ++ " " ++ (show hana) 

solve :: [[String]] -> [Int]
solve s = let t = map (\[x,y] -> 
                        if x>y then [3,0]
                        else if x<y then [0,3]
                             else [1,1] ) s
          in foldl (\[sx,sy] [x,y] -> [sx+x,sy+y]) [0,0] t