Complexity
InterviewTime limit2sMemory limit1024 MB
Count the unordered pairs of k by k subgrids that are not similar, where similar means one becomes the other after flipping whole rows or columns.
Problem
Fedot is a designer who has been given an important job: laying out black and white tiles in an artistic pattern. His latest task is to lay black and white tiles on an square.
Fedot loves his work and prepares carefully for every project. He considers two squares similar if one of them can be obtained from the other by flipping colors in some row or column several times.

All of these squares are similar to each other, and no other square is similar to them.
Fedot noticed that clients never look at the whole work at once. Their view is usually limited to a square. To evaluate sketches, he introduced a value called complexity. It is the number of pairs of squares that appear in the picture and are not similar to each other.
By trial and error, Fedot found that clients like pictures of a certain complexity. He thinks that too much complexity looks like chaos, and too little is boring.
Before laying tiles, Fedot prepared several sketches. Help him compute their complexity.
Input
The first line contains two integers and (). The next lines describe the sketch. Each line has length and consists only of the characters and . The character stands for a white tile, and stands for a black tile.
Output
Print one integer , the complexity of the picture.