N = gets.to_i
S = N.times.map{gets.chomp}

S.map! do |s|
  s.chars.sort.join
end

uniq_S = S.uniq
hash = {}

uniq_S.each do |s|
  hash[s] = 0
end

S.each do |s|
  hash[s] += 1
end

ans = 0

def factorial(number)
  (1..number).inject(1,:*)
end

hash.each do |k,v|
  next if v <= 1
  ans += factorial(v) / (2 * factorial(v-2))
end

puts ans
