#P12314. Unique Sets Count

    ID: 14412 Type: Default 1000ms 256MiB

Unique Sets Count

Unique Sets Count

Given \(n\) sets, where each set \(S_i\) may contain at most 5 strings \(S_{i,j}\) (each string consisting only of lowercase letters and of length at most 4), the elements within each set might be repeated.

Your task is to compute the number of unique sets after deduplication. First, for each set, remove duplicate elements. Then, from all the \(S_i\), count how many unique sets there are (i.e. sets with the same deduplicated elements are considered equal). Each set is given in the format: {"abc"} or {"a","b","c","d"} (with no spaces).

inputFormat

The first line contains an integer \(n\) (the number of sets). Each of the next \(n\) lines contains a set represented in the format described above.

outputFormat

Output a single integer representing the number of unique sets after deduplication.

sample

3
{"a","b","a"}
{"b","a"}
{"c"}
2

</p>