JOI and IOI are best friends. One day, JOI and IOI went to stargaze at an observatory on top of a mountain.
From the observatory, N stars are visible. Each star is numbered from 1 to N, and is either red, blue, or yellow in color.
The stars visible from the observatory can be represented as points on a coordinate plane. In this coordinate plane, the point corresponding to star
JOI and IOI decided they wanted to create a constellation, which they would name JOIOI. First, they thought of using a triangle to connect three stars of different colours: red, blue, and yellow. Such a triangle is called a good triangle.
The two of them decided that each pair of good triangles is a candidate for the JOIOI constellation, so long as they satisfy the following condition:
The first line of input consists of a single integer
Output a single integer on a single line, the total number of candidates for the JOIOI constellation.
Subtask # | Score | Constraints |
---|---|---|
1 | 15 | |
2 | 40 | |
3 | 45 | No additional constraints |
Sample Input 1 | Sample Output 1 |
7
0 0 0
|
4
|
In this input example, the stars are arranged as shown in the figure below. In this figure, the red stars are represented by circles, the blue stars by diamonds, and the yellow stars by triangles.
The four constellations satisfying the required conditions are:
Sample Input 2 | Sample Output 2 |
8
16 0 0
|
12
|
Sample Input 3 | Sample Output 3 |
21
|
7748
|
Subtask | Score |
---|---|
1 | 15 |
2 | 40 |
3 | 45 |
4 | 0 |