# -*= coding; utf-8 -*-

def main()
  lines = readlines.map {|l| l.chomp }
  n = lines[0].to_i
  h = Hash.new(0)
  (1..n).each do |i|
    s = lines[i].chars.sort.join
    h[s] += 1
  end
  ans = 0
  h.each do |k, c|
    ans += c * (c - 1) / 2
  end
  puts ans
end


if __FILE__ == $0
  main
end
