object Main extends App {
  val scanner = new java.util.Scanner(System.in)

  val n = scanner.nextInt()
  val cards = (1 to n).map { _ =>
    (scanner.next(), scanner.next())
  }

  val outputs = cards.foldLeft((0, 0)) { (point, card) =>
    val (taroP, hanakoP) = point
    val (taro, hanako) = card

    if(taro == hanako) {
      (taroP + 1, hanakoP + 1)
    } else if(taro > hanako) {
      (taroP + 3, hanakoP)
    } else {
      (taroP, hanakoP + 3)
    }
  }

  println(s"${outputs._1} ${outputs._2}")
}