You are given $n$ points on the plane, such that no three points lie on the same line. We say that line segments $AB$ and $CD$ cross if they share a point $X$ different from the points $A$, $B$, $C$ and $D$. Let $S$ be the set of all line segments between pairs of the given points. Find the number of segments in $S$ that don’t cross with any other segment in $S$.
Input
The first line contains an integer $n$ ($3 \le n \le 1000$), the number of points. The following $n$ lines contain integers $x_{i}$ and $y_{i}$ (−$10^{9} \le x_{i}$, $y_{i} \le 10^{9}$), the coordinates of the points.
Output
Output the requested number of segments.
Example 1
Input
4 1 1 -1 1 -1 -1 1 -1
Output
4
Example 2
Input
4 -1 -1 1 -1 0 1 0 0
Output
6
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.