n = gets.chomp.to_i
s = []
(1..n).each do |i|
  s << gets.chomp
end

ss = s.map { |elem| elem.chars.group_by { |e| e } }
cnt = 0

ss.each do |i|
  ss.each do |j|
    if i == j
      cnt += 1
    end
  end
end

puts (cnt - n) / 2