TTRGRAPH - Tetrahedrons in the country


Today we continue examine topology of the ancient country GRAPH. It was said that any four cities form a tetrahedron (or 4-vertex clique) if from every city of the tetrahedron there is a road to another tetrahedron city. In the picture below is an example of tetrahedron.

Theoretical note: all test cases are ErdÅ‘s–Rényi connected low density graphs.

TTRGRAPH

Your task is to find the number of tetrahedrons in the country.

 

Input

The first line of input will contain one integer number 4 ≤ N ≤ 900, number of cities in GRAPH. Follow N lines. Each line represents cities (direct neighbors) connected to the city number i (cities numbering is zero based) by one road.

Output

Print number of tetrahedrons in the GRAPH.

Example

Input:
4
1 2 3
0 2 3
0 1 3
0 1 2
Output:
1


Added by:julkas
Date:2018-06-08
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All