$stdin = DATA if $stdin.eof?

gets

score_t = 0
score_h = 0

ARGF.each do |line|
  w1, w2 = line.split.map(&:chomp)
  if w1 == w2
    score_t += 1
    score_h += 1
  elsif (w1 <=> w2) == 1
    score_t += 3
  else
    score_h += 3
  end
end

puts "#{score_t} #{score_h}"