import scala.io.StdIn.{readInt, readLine}

object Main extends App {
  val n     = readInt()
  val lines = Iterator.fill(n)(readLine())
  val cards = lines.map { _.split(" ") }.map { case Array(a, b) => (a, b) }

  val (taro, hanako) = cards.foldLeft((0, 0)) { (score, line) =>
    val (a, b) = line
    val (x, y) = score

    if (a == b)
      (x + 1, y + 1)
    else if (a > b)
      (x + 3, y)
    else
      (x, y + 3)
  }

  println(s"$taro $hanako")
}

