def combi(n,k)
  k=n-k if 2*k > n
  return 1 if k == 0
  ((n-k+1)..n).reduce(&:*)/((1..k).reduce(&:*))
end

n = gets.to_i
items = Hash.new(0)
n.times do |i|
  s = Hash.new(0)
  gets.chomp.chars{|ch| s[ch] += 1 }
  items[s] += 1
end


ans = 0
items.each do |k, v|
  ans += combi(v, 2) if v >= 2
end
pp ans
