N = gets.to_i
s = Hash.new(0)
fact = [1]
N.times do |i|
    cs = Hash.new(0)
    gets.chomp.chars.each do |char|
        cs[char] += 1
    end
    s[cs] += 1
    fact[i+1] = fact[i] * (i+1)
end
ans = 0
s.values.each do |num|
    if num >= 2
        ans += fact[num] / (fact[2] * fact[num - 2])
    end
end
puts ans