2951 - How Many Keys

Created by Orlenys López Pintado
Added by kko (2014-06-11)
Limits
Total Time: 20000 MS | Test Time: 6000 MS |Memory: 62 MB | Output: 64 MB | Size: 14 KB
Enabled languages
Available in

Description

Not so long ago a group of scientists from the Americas Centre for Messaging (ACM) came up with a new way to encode messages. The algorithm begins by generating a list of keys L which are later on used to encode different messages. Like many other algorithms out there, this one worked perfectly until a vulnerability was detected immediately exploited. The first investigation report indicates that the algorithm fails whenever two or more keys are similar, that is, when they are composed of exactly the same digits. A quick-fix to this problem is quite simple: for each group of K similar keys, the algorithm must take K - 1 off L.

Your task is very simple. Write a program that calculates the final size of L.
Not so long ago a group of scientists from the Americas Centre for Messaging (ACM) came up with a new way to encode messages. The algorithm begins by generating a list of keys L which are later on used to encode different messages. Like many other algorithms out there, this one worked perfectly until a vulnerability was detected immediately exploited. The first investigation report indicates that the algorithm fails whenever two or more keys are similar, that is, when they are composed of exactly the same digits. A quick-fix to this problem is quite simple: for each group of K similar keys, the algorithm must take K - 1 off L.

Your task is very simple. Write a program that calculates the final size of L.
Not so long ago a group of scientists from the Americas Centre for Messaging (ACM) came up with a new way to encode messages. The algorithm begins by generating a list of keys L which are later on used to encode different messages. Like many other algorithms out there, this one worked perfectly until a vulnerability was detected immediately exploited. The first investigation report indicates that the algorithm fails whenever two or more keys are similar, that is, when they are composed of exactly the same digits. A quick-fix to this problem is quite simple: for each group of K similar keys, the algorithm must take K - 1 off L.

Your task is very simple. Write a program that calculates the final size of L.

Input specification

Line 1: the number N (1 <= N <= 10^5) of keys in L.
Lines 2 … N + 1: a key in L. It is guaranteed that all keys will contain no more than 31 digits and no key starts with a digit zero.
Line 1: the number N (1 <= N <= 10^5) of keys in L.
Lines 2 … N + 1: a key in L. It is guaranteed that all keys will contain no more than 31 digits and no key starts with a digit zero.
Line 1: the number N (1 <= N <= 10^5) of keys in L.
Lines 2 … N + 1: a key in L. It is guaranteed that all keys will contain no more than 31 digits and no key starts with a digit zero.

Output specification

A single line with the answer to the problem.
A single line with the answer to the problem.
Line 1: the number N (1 <= N <= 10^5) of keys in L.
Lines 2 … N + 1: a key in L. It is guaranteed that all keys will contain no more than 31 digits and no key starts with a digit zero.

Sample input

4
432
324
4322
158

Sample output

3

Hint(s)

;jsessionid=3FB673887CFC80E06C02396011874CC5

;jsessionid=3FB673887CFC80E06C02396011874CC5

;jsessionid=3FB673887CFC80E06C02396011874CC5