n = gets.to_i
arr = n.times.map{gets.chomp}

arr.map! {|s| s.split('').sort.join}.sort!
count = 0

while a = arr.shift
  if arr.empty?
    break
  end

  for b in arr
    if a == b
      count += 1
    else
      break
    end
  end
end
puts count