tarop = hanap = 0
gets
while cards = gets do
  taro, hana = cards.split
  tarop += ( taro == hana )? 1 : ( taro > hana )? 3 : 0
  hanap += ( taro == hana )? 1 : ( hana > taro )? 3 : 0
end
puts "#{tarop} #{hanap}"