Problem hidden

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

Adicionado por:julkas
Data:2018-06-08
Tempo limite:0.5s
Tamanho do fonte:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Linguagem permitida:Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.