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