n = gets.to_i
taro = {"score" => 0, "card" => ""}
hanako = {"score" => 0, "card" => ""}

for i in 1..n
  taro["card"], hanako["card"] = gets.split(" ")
  hanako["score"] += 3 if taro["card"] < hanako["card"]
  taro["score"] += 3 if taro["card"] > hanako["card"]
  if taro["card"] == hanako["card"]
    taro["score"] += 1; hanako["score"] += 1
  end
end

puts "#{taro["score"]} #{hanako["score"]}"