n = gets.chomp.to_i
s = []
n.times do
  s.push(gets.chomp.split('').sort.join(''))
end

h = s.group_by(&:itself).map{ |key, value| [key, value.count] }.to_h

@memo = Hash.new(0)
ans = 0
h.each_value do |v|
  next if v == 1
  @memo[v] if @memo[v] != 0
  @memo[v] = (1..v).to_a.combination(2).to_a.size
  ans += @memo[v]
end
p ans
