409827: GYM103800 D Ginger's line

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Ginger's linetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Ginger have $$$n$$$ straight lines $$$y = a_i x + b_i$$$, now Ginger wants to know how many pairs of straight lines $$$i,j(i<j)$$$ intersect.

Input

The first line contains a integer $$$n$$$ $$$(1 \le n \le 5 \times 10 ^ 3)$$$ indicating the number of lines.

The next $$$n$$$ lines contains two integers $$$a_i, b_i$$$ $$$(-10 ^3 \le a_i, b_i \le 10^3)$$$ indicating line $$$y = a_i x + b_i$$$.

Output

Print the pairs of intersections of lines.

ExamplesInput
5
1 1
2 2
3 3
4 4
5 5
Output
10
Input
2
1 0
1 0
Output
0
Note

Note that overlapping lines do not intersect.

加入题单

算法标签: