All problems

Problem 833

Unique Morse Code Words

Easy · 10 pts · String, Hash Table

Problem

Each letter has an international Morse code: a is .-, b is -..., c is -.-., and so on through z, which is --... A word is transformed by writing the codes of its letters one after another with no separators, so different words can produce the same transformation. Given a list of words, count the distinct transformations. Build each code string and put it in a set.

Input

The first line contains N. The second line contains the N words (lowercase letters).

Output

Print the number of different transformations.

Constraints

1 <= N <= 100; 1 <= |word| <= 12

Example input

4
gin zen gig msg

Example output

2

Explanation

gin and zen both become --...-., while gig and msg both become --...--.. So the four words gin zen gig msg have only 2 different transformations.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Jewels and Stones Next: Find the Difference