#abc258g. [abc258_g]Triangle
[abc258_g]Triangle
Problem Statement
You are given a simple undirected graph with vertices.
is given as the adjacency matrix . That is, there is an edge between Vertices and if is , and there is not if is .
Find the number of triples of integers satisfying such that there is an edge between Vertices and , an edge between Vertices and , and an edge between Vertices and .
Constraints
- is the adjacency matrix of a simple undirected graph .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
0011
0011
1101
1110
Sample Output 1
2
satisfy the condition.
does not satisfy the condition, because there is no edge between Vertices and .
Thus, the answer is .
Sample Input 2
10
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
Sample Output 2
0