In the early 19th century, the ruler Hoseyngulu Khan Sardar ordered a palace to be built on a plateau overseeing a beautiful river. The plateau is modeled as an grid of square cells. The rows of the grid are numbered through , and the columns are numbered through . We refer to the cell in row and column as cell . Each cell has a specific height, denoted by .

Hoseyngulu Khan Sardar asked his architects to choose a rectangular **area** to build the
palace. The area should not contain any cell from the grid boundaries (row , row
, column , and column ). Hence, the architects should choose four integers
and and , which define an area
consisting of all cells such that and .

In addition, an area is considered **valid**, if and only if for every cell in the area,
the following condition holds:

- Consider the two cells adjacent to the area in row cell and cell and the two cells adjacent to the area in column cell and cell . The height of cell should be strictly smaller than the heights of all these four cells.

Your task is to help the architects find the number of valid areas for the palace (i.e., the number of choices of and that define a valid area).

#### Implementation details

You should implement the following procedure:

```
long long count_rectangles(std::vector<std::vector<int>> a)
```

- : a two-dimensional by array of integers representing the heights of the cells.
- This procedure should return the number of valid areas for the palace.

#### Examples

##### Example 1

Consider the following call.

```
count_rectangles([[4, 8, 7, 5, 6],
[7, 4, 10, 3, 5],
[9, 7, 20, 14, 2],
[9, 14, 7, 3, 6],
[5, 7, 5, 2, 7],
[4, 5, 13, 5, 6]])
```

There are valid areas, listed below:

For example is a valid area because both following conditions hold:

- is strictly smaller than and .
- is strictly smaller than and .

##### Constraints

- for all

##### Subtasks

- ( points)
- ( points)
- ( points)
- ( points)
- ( points)
- ( points) for all
- ( points) No additional constraints.

#### Sample grader

The sample grader reads the input in the following format:

- line :
- line for :

The sample grader prints a single line containing the return value of `count_rectangles`

.

## Comments