Problem9684--ABC187 —— B - Gentle Pairs

9684: ABC187 —— B - Gentle Pairs

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

On the $xy$-plane, We have $N$ points numbered $1$ to $N$. Point $i$ is at $(x_i, y_i)$, and the $x$-coordinates of the $N$ points are pairwise different.

Find the number of pairs of integers $(i, j)\ (i < j)$ that satisfy the following condition:

-   The line passing through Point $i$ and Point $j$ has a slope between $-1$ and $1$ (inclusive).

Input

Input is given from Standard Input in the following format:

```
$N$
$x_1$ $y_1$
$\vdots$
$x_N$ $y_N$
```

Output

Print the answer.

Constraints

-   All values in input are integers.
-   $1 \le N \le 10^3$
-   $|x_i|, |y_i| \le 10^3$
-   $x_i \neq x_j$ for $i \neq j$.

Sample 1 Input

3
0 0
1 2
2 1

Sample 1 Output

2
The slopes of the lines passing through (0,0) and (1,2), passing through (0,0) and (2,1), and passing through (1,2) and (2,1) are 2, $\frac{1}{2}$, and -1, respectively.

Sample 2 Input

10
-31 -35
8 -36
22 64
5 73
-14 8
18 -58
-41 -85
1 -88
-21 -85
-11 82

Sample 2 Output

11

Source/Category