n = gets.to_i
s = (1..n).map{ gets }
compress = s.map{|i| i.chomp.chars.sort.join}.sort
ans = 0
count = 0
compress.inject {|before, c| 
    if before == c
        count += 1
        ans += count 
    else
        count = 0
    end
    before = c
}
p ans