#000373

Iodine

Given a set of N strings, you need to find out how many different strings are among specified. Suppose that two strings are considered as equal if one of them can be produced from another by several cyclic shifts.


InputThe first line contains the integer N (N < 1111). The next N lines contain strings. All strings are composed of small Latin letters. All strings have equal length. Length of strings will be no more than 1111 letters.

OutputThe only line should contain one integer, the answer to the problem.

Input:
4
goog
oogg
ogog
gogo

Output:
2

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.