n = gets.chop.to_i

a = []
c = 0
n.times do |n|
  t = Hash.new(0)

  s = gets.chop.to_s
  s.scan(/./) { |m| t[m] += 1} 

  b = Array.new(a)
  while k = b.index(t)
    c += 1
    b.delete_at(k)
  end
  a << t
end

puts c