n = STDIN.gets.chomp.to_i
input = []
ans = 0
for i in 0...n
  input[i] = STDIN.gets.chomp.split(//).sort.join
end
x = input.group_by do |i| i end
x.count {|k,v|
  if v.size > 1
    for j in 1...v.size
      ans += j
    end
  end
}
puts ans