#P1808. 单词分类

单词分类

Description

Oliver decides to memorize English vocabulary, but he soon finds it hard to remember disordered words directly, so he decides to classify them.

Two words belong to the same class if and only if the counts of each letter in the two words are equal.

For example, AABAC\verb!AABAC! and CBAAA\verb!CBAAA! can be grouped into the same class, whereas AAABB\verb!AAABB! is not in the same class.

Now Oliver has NN words. All words consist of uppercase letters, and each word has a length of at most 100100. You need to tell Oliver how many classes these words are divided into.

Input Format

The first line contains the number of words NN. Each of the next NN lines contains one word.

Output Format

Output a single integer, which is the number of classes into which these NN words are divided.

3 
AABAC 
CBAAA 
AAABB
2

Hint

  • For 70%70\% of the testdata, 1N1001 \le N \le 100.
  • For 100%100\% of the testdata, 1N100001 \le N \le 10000.

Translated by ChatGPT 5