n = gets.strip.chomp.to_i

cnt = 0
a=[]
n.times do
  a << gets.strip.chomp.chars.sort!
end

(a.size-1).times do |i|
  ((i+1)..a.size-1).each do |j|
    #p j
    b = a[j]
    #p b
    #puts "#{a[i]} to #{b}"
    cnt +=1 if a[i] == b 
  end
end
puts cnt