#!/usr/bin/env ruby
$VERBOSE = true
n, = ARGF.gets.split.map {|x| x.to_i}
hash1 = Hash.new(0)
(1..n).map do
  hash2 = Hash.new(0)
  str = ARGF.gets
  if str
    str.chomp.each_codepoint do |ch|
      hash2[ch] += 1
    end
    hash1[hash2.hash] += 1
  end
end
puts hash1.values.map{|v|(v-1)*v/2}.sum
