Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/string-anagramma-guruhlari

Anagram groups

Medium 1000 ms 128 MB 48%
Share

$n$ words are given, each made of lowercase Latin letters. Words that are anagrams of each other (made of the same letters, possibly in a different order) belong to one group. Find the number of groups.

Splitting words with the same set of letters into groups

Input

The first line contains a positive integer $n$. Each of the next $n$ lines contains one word.

Output

One integer.

Note

$1 \le n \le 10^{4}$
Every word consists of $1$ to $10$ lowercase Latin letters

Examples

Input #1
6
listen
silent
enlist
google
elgoog
abc
Output #1
3
Input #2
3
a
b
a
Output #2
2

Sign in to submit a solution

Signing up is free and takes a minute.