Submit solution

Points:
7 (partial)

Time limit:
2.5s

Java
4.0s

PyPy 2
4.0s

PyPy 3
4.0s

Memory limit:
256M

Author:

Problem types

Rain loves triangles, especially equilateral ones. Thus, Rain has points in -dimensional space where each coordinate point is either or , and he wants you to calculate the number of equilateral triangles with vertices on the points. The distance between two points is the usual Euclidean distance.

The Euclidean distance between points is .

#### Constraints

The points are pairwise-distinct.

**Subtask 1 [80%]**

**Subtask 2 [20%]**

No additional constraints.

#### Input Specification

The first line contains two integers and .

The next lines each represent a point . Each line has integers , representing the coordinates of the point.

#### Output Specification

Output the number of equilateral triangles where each vertex is a given point.

#### Sample Input

```
4 3
0 0 1
1 0 0
0 1 0
0 1 1
```

#### Sample Output

`1`

#### Explanation for Sample

Only the first points form an equilateral triangle.

## Comments