n = gets.chomp.to_i
hash = {}
n.times do
    tmp = gets.chomp.split("").sort
    if hash.has_key?(tmp)
        hash[tmp] += 1
    else
        hash[tmp] = 1
    end
end
ans = 0
hash.each do |k,v|
    ans += v * (v-1) / 2
end
puts ans