module Main where

import Data.Functor
import Data.Char

main :: IO ()
main =  do
  { [n]   <- getInts
  ; (t,h) <- turn n (0,0)
  ; putStrLn $ unwords $ map show [t,h]
  }

turn :: Int -> (Int, Int) -> IO (Int, Int)
turn 0 th = return th
turn n (t,h) = do
  { [ts,hs] <- words <$> getLine
  ; case compare ts hs of
      LT -> turn (n-1) (t,h+3)
      EQ -> turn (n-1) (t+1,h+1)
      GT -> turn (n-1) (t+3,h)
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine