MODE = "stdio"
require 'matrix'
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '3
  cat dog
  fish fish
  lion tiger'.split("\n")
  tmp.each{|s|
    line << s.strip
  }
end
n=line[0].to_i

t_p,h_p=[0,0]
(1..n).each do |m|
  t,h = line[m].split(" ")
  if t<h
    h_p += 3
  elsif h<t
    t_p += 3
  else
    t_p += 1
    h_p += 1
  end
end

puts "#{t_p} #{h_p}"