n = gets.chomp.to_i
s = []

for i in 1..n do
    word = gets.chomp.split("")
    tar = word.sort.join
    head = 0
    tail = s.size
    while head < tail 
        mid = (head+tail)/2
        if s[mid] == tar
            break
        elsif (s[mid] <=> tar) < 0
            head = mid + 1
        else
            tail = mid - 1
        end
    end
    mid = ((head+tail)/2.0).ceil
    s.insert(mid,tar)
end

sum = 0
tmp = 1
for i in 1..n-1 do
    if s[i-1] == s[i]
        tmp += 1
    else
        sum += tmp*(tmp-1)/2
        tmp = 1
    end
end

sum += tmp*(tmp-1)/2

p sum
