cards = []
scores = [0, 0]

gets.to_i.times { cards << gets.chomp.split }

cards.each do |card|
	sorted = card.sort

	card[0] == card[1] ? scores.map!{|s| s += 1}
	  : card[0] == sorted[1] ? scores[0] += 3
	  : scores[1] += 3
end

puts "#{scores[0]} #{scores[1]}"

