n = gets.to_i
s = readlines.map {|i| i.chomp}

s2 = s.map{|ss| ss.chars.sort}.sort
count = 0
0.upto(n) do |i|
  (i+1).upto(n) do |j|
    if s2[i]==s2[j]
      count+=1
      i+=1
    else
      break
    end
  end
end

puts count