#K51817. Unique Tracks Counting

    ID: 29172 Type: Default 1000ms 256MiB

Unique Tracks Counting

Unique Tracks Counting

You are given a list of track names. Each track name is a string that may include underscore characters ('_'). Two tracks are considered identical if, after removing all underscores, the characters of the track, when sorted in ascending order, produce the same string.

In other words, for a given track \( s \), let its cleaned version be \( s' = \text{replace}(s, \_, '') \) and let \( \sigma(s') \) denote the sorted string of \( s' \). Two tracks \( s_1 \) and \( s_2 \) are considered identical if and only if \( \sigma(s'_1) = \sigma(s'_2) \).

Your task is to count the number of unique tracks based on this rule.

inputFormat

The input is read from standard input and has the following format:

  1. An integer \( t \) representing the number of tracks.
  2. Followed by \( t \) lines, each containing a track name.

You can assume that each track name is a non-empty string consisting of lowercase letters and underscores.

outputFormat

Output a single integer to standard output — the number of unique tracks as defined above.

## sample
5
abc_def
ab_cdef
cdef_ab
g_hi
hi_g
2