RATAR - Ratar

题意翻译

有一个N*N 的矩阵,矩阵内元素大小ai∈[−1000,1000] 现在你要选两个子矩 阵,满足: - 1.两个子矩阵内的元素之和恰好相等。 - 2.两个子矩阵的边界(指的是矩形的边界,不是指边界的元素)恰好有一个公共点, - 3.不存在一个元素同时属于这两个子矩阵。 求方案数。

题目描述

Unexpected problems with law enforcement have convinced Mirko to take up a less lucrative but less

输入输出格式

输入格式


The first line of input contains the positive integer N (1 land plot. Each of the following N lines contains N space-separated numbers Aij (-1000 < Aij < 1000), the income provided by the respective cell.

输出格式


The first and only line of output must contain the total number of plot pairs satisfying the given condition.

输入输出样例

输入样例 #1

3
1 2 3
2 3 4
3 4 8

输出样例 #1

7