n = gets.chomp.to_i

strs = Hash.new(0)
ans = 0
n.times do
    str = gets.chomp.split("").sort.join("")
    appearance = strs[str]
    if appearance == 0
        strs[str] = 1
    else
        ans += appearance
        strs[str] += 1
    end
end
puts ans
