#400. Necklace

Necklace

Description

Give you n ( n < 10000) necklaces ,thelength of necklace will not large than 100,tell me

How many kinds of necklaces total have.(iftwo necklaces can equal by rotating ,we say the two necklaces are some).

For example 0110 express a necklace, youcan rotate it.

0110 -> 1100 -> 1001 ->0011->0110.

Input Format

The input contains multiple test cases.

Each test case include: first one integersn. (2<=n<=10000)

Next n lines follow. Each line has a equallength character string. (string only include '0','1').

Output Format

For each test case output a integer , howmany different necklaces.

Sample

4
0110
1100
1001
0011
1

Sample

4
1010
0101
1000
0001
2
## hint 题目有多组数据