Kites

The season of flying kites is well ahead. So what? Let us make an inventory for kites. We are given a square shaped sheet of paper. But many parts of this are already porous. Your challenge here is to count the total number of ways to cut a kite of any size from this sheet. By the way, the kite itself can’t be porous :-) AND ...it must be either square shaped or diamond shaped. x x xxx xxx xxxxx x xxx x xxx xxx xxx x.x x xxx xxx In the above figure first three are valid kites but not next two. Input Input contains an integer n (n ≤ 500), which is the size of the sheet. Then follows n lines each of which has n characters (‘x’ or ‘.’). Here the dotted parts resemble the porous parts of the sheet. Input is terminated by end of file. Output Output is very simple. Only print an integer according to the problem statement for each test case in a new line. Sample Input 4 .xx. xxxx .xx. .x.. 3 xxx xxx xxx Sample Output 4 6