n = gets.chomp.to_i

dicts = []

n.times do |i|
  dicts[i] = Hash.new(0)
  gets.chomp.chars.each do |c|
    dicts[i][c] += 1
  end
end

i = 0

dicts.combination(2) do |a, b|
  i += 1 if a == b
end

puts i