object Main extends App {
  val sc = new java.util.Scanner(Console.in)

  def nextInt() = Integer.parseInt(sc.next)
  def next() = sc.next

  var taro = 0
  var hanako = 0

  var n = nextInt
  while (n > 0) {
    val cmp = next compare next
    if (cmp > 0)
      taro += 3
    else if (cmp < 0)
      hanako += 3
    else {
      taro += 1
      hanako += 1
    }
    n -= 1
  }

  println(s"$taro $hanako")
}

