n = gets.to_i
cards = []
t = 0
h = 0

n.times do
    cards << gets.split.map(&:to_s)
end

for i in 0...n do
    if(cards[i][0].length == cards[i][1].length) then
        t += 1
        h += 1
    elsif(cards[i][0].length > cards[i][1].length) then
        t += 3
    elsif(cards[i][0].length < cards[i][1].length) then
        h += 3
    end
end

puts "#{t} #{h}"