N = gets.to_i
s = Hash.new(0)
fact = [1]
N.times do |i| 
    s[gets.chomp.chars.sort] += 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