result = gets.chomp.to_i.times.reduce({t: 0, r: 0}) { |result, t|
  card_t, card_r = gets.chomp.split
  if card_t < card_r
    result[:r] += 3
  elsif card_t > card_r
    result[:t] += 3
  else
    result[:r] += 1
    result[:t] += 1
  end
  result
}
puts "#{result[:t]} #{result[:r]}"
