def main(argv)
  n = gets.chomp.to_i
  s = [''] * n
  n.times {|i| s[i] = gets.chomp.split('').sort! }
  
  c = 0
  flag = [false] * n
  n.times do |i|
    next if flag[i]
    flag[i] = true
    
    d = 0
    ((i + 1)...n).each do |j|
      if s[i] == s[j] then
        flag[j] = true
        d += 1
      end
    end
    c += (d * (d + 1)) / 2
  end
  
  puts c.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end