#require 'pp'
#require 'set'

n = gets.chomp!.to_i
s_n = []
ana = {}
n.times do |i|
    s = gets.chomp!.chars.sort.join
    ana[s] ||= 0
    ana[s] += 1
end

$memo = {
    1 => 0,
    2 => 1,
}

def count(n)
    return $memo[n] if $memo[n]

    $memo[n] = (n - 1) + count(n-1)
    return $memo[n]
end

sum = 0
ana.each do |a, b|
    sum += count(b)
end

puts sum
