
count = gets.to_i
arr = []

count.times do
  arr << gets.split(" ")
end
ans = [0, 0]
arr.each do |val|
  if val[0] == val[1]
    ans[0] += 1
    ans[1] += 1
  elsif val[0] < val[1]
    ans[1] += 3
  else
    ans[0] += 3
  end
end

puts ans[0].to_s + " " + ans[1].to_s