import scala.io.StdIn._

object Main {
  def cardGame(gameNum: Int): List[Int] = {
    def loop(n: Int, p1: Int = 0, p2: Int = 0): List[Int] = {
      if (n > 0) {
        val cards = readLine().split(" ")
        val sortedCards = cards.sorted

        if (cards(0) == cards(1)) loop(n - 1, p1 + 1, p2 + 1)
        else if (cards(0) == sortedCards(0)) loop(n - 1, p1 + 0, p2 + 3)
        else loop(n - 1, p1 + 3, p2 + 0)
      } else List(p1, p2)
    }

    loop(gameNum)
  }

  def main(args: Array[String]): Unit = {
    val gameNum = readInt()
    println(cardGame(gameNum).mkString(" "))
  }
}