n = gets.chomp.to_i

s = []

count = 0
hits = {}

n.times do
  now = gets.chomp.chars.sort.join
  if hits.key?(now)
    count += (hits[now] + 1)
    hits[now] += 1
  else
    hits[now] = 0
  end
end

puts count
