For the given sequence of integers A_1, \ldots, A_n, determine the maximum length of a subsequence in which there is no pair of mutually close numbers. Two numbers are considered mutually close if each can be obtained from the other by a cyclic shift of all digits of their decimal representation. For example, numbers and are mutually close, while and are not, since you cannot obtain one from the other by a cyclic shift of all digits.
The first line contains the number , and the second line contains the numbers A_1, \ldots, A_n.
Print a single line with the answer to the problem.
Example 1