n = gets.to_i - 1
arr = Array.new
while line = $stdin.gets
arr << line.chomp.split("")
end
ans = 0
hash = {}
arr.each{|obj|
  item = obj.sort
  if hash[item] == nil then
    hash[item] = 0
  else
    hash[item] += 1
    ans += hash[item]
  end
}
p ans