CF11C How Many Squares?

Description

You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least $ 2×2 $ . We are only interested in two types of squares: 1. squares with each side parallel to a side of the matrix; 2. squares with each side parallel to a diagonal of the matrix. For example the following matrix contains only one square of the first type: ``` 0000000 0111100 0100100 0100100 0111100 ``` The following matrix contains only one square of the second type: ``` 0000000 0010000 0101000 0010000 0000000 ``` Regardless of type, a square must contain at least one 1 and can't touch (by side or corner) any foreign 1. Of course, the lengths of the sides of each square should be equal. How many squares are in the given matrix?

Input Format

N/A

Output Format

N/A