object Main {
  def main(args: Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)

    val n = scanner.nextInt
    var st, sh = 0
    for(_ <- 1 to n) {
      val ct, ch = scanner.next
      val c = ct.compareTo(ch)
      if(c > 0) st = st + 3 else if(c < 0) sh = sh + 3 else { st = st + 1; sh = sh + 1 }
    }
    println(s"$st $sh")
  }
}

