Mirror Images


Mirror Images

Kasey is a digital artist who designs 8 bit logos for her clients. She is a bit of a lazy (a.k.a. inventive) worker though, and wants to get the most out of her designs.

Whenever Kasey makes a design to give to clients, she also tries flipping her art to give additional designs to other clients. With just flipping alone, there are 4 axis against which Kasey can flip her square artwork, and generate 7 other designs:

However, Kasey doesn't want to give two identical images to her clients, or they will suspect something. Can you help Kasey identify how many unique flip designs there are?

Input

Input will start with a single integer nn, the height/width of the design. Input will then contain nn lines, each containing nn characters (either . or X)

Output

Output should contain a single integer kk, the number of unique designs possible

Example

Input

Sample 1
4
X..X
.X..
..X.
X..X

Output

Sample 2
2

There are only two possible designs:

Sample 3
X..X
.X..
..X.
X..X

and

Sample 4
X..X
..X.
.X..
X..X

Constraints

  • 1n10001 \leq n \leq 1000

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.