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

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

  def game(n:Int, taro:Int, hanako:Int): Tuple2[Int, Int] = {
    if (n == 0)
      (taro, hanako)
    else {
      val cmp = next compare next
      if (cmp > 0)
        game(n-1, taro+3, hanako)
      else if (cmp < 0)
        game(n-1, taro, hanako+3)
      else
        game(n-1, taro+1, hanako+1)
    }
  }

  val (taro, hanako) = game(nextInt, 0, 0)
  println(s"$taro $hanako")
}

