시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 3 3 2 100.000%

문제

A suspicious-looking convex polygon wants to escape its current position by translating itself along some straight-line direction. Three very diligent straight lines want to lock it up by placing themselves along three distinct sides of the polygon. Then, if the triple of lines defines a triangle and the polygon lies inside this triangle, it will be locked up. Otherwise, it will escape.

Figure (a) above illustrates a triple that will lock the polygon up. For (b), the lines do not define a triangle since two of them are parallel, and so the polygon will escape. In (c), the polygon lies outside the triangle defined by the triple and it will easily escape.

Given a polygon, you must compute the number of distinct triples of lines that can lock the polygon up.

입력

The first line contains an integer N (3 ≤ N ≤ 105) representing the number of vertices of the polygon. Each of the next N lines describes a vertex with two integers X and Y (−108 ≤ X, Y ≤ 108) indicating the coordinates of the vertex in the XY plane. The vertices are given in counter-clockwise order and they define a simple convex polygon. No three vertices are collinear.

출력

Output a single line with an integer indicating the number of distinct triples of lines that can lock the given polygon up.

예제 입력 1

4
0 0
10 0
10 10
0 5

예제 출력 1

1

예제 입력 2

8
0 32
-12 15
-10 -10
0 -12
10 -12
22 0
25 10
18 20

예제 출력 2

18

예제 입력 3

3
10 -10
0 10
-10 -10

예제 출력 3

1

예제 입력 4

6
-100000000 131
-50000067 -100000000
50000014 -100000000
100000000 -109
70000173 100000000
-90000011 100000000

예제 출력 4

6

예제 입력 5

4
0 0
10 0
10 10
0 10

예제 출력 5

0