LINES - Game of Lines

Farmer John has challenged Bessie to the following game: FJ has a board with dots marked at N (2 ≤ N ≤ 200) distinct lattice points. Dot i has the integer coordinates Xi and Yi (-1,000 ≤ Xi, Yi ≤ 1,000).

Bessie can score a point in the game by picking two of the dots and drawing a straight line between them; however, she is not allowed to draw a line if she has already drawn another line parallel to it. Bessie would like to know her chances of winning, so she has asked you to help find the maximum score she can obtain.

Input

There will be multiple test cases. For each case, the first line contains the integer N, and each of the next N lines gives a pair of integers, Xi and Yi. The file ends with the case N = 0, which should not be processed.

Output

For each test case, print a single integer representing the maximum number of lines Bessie can draw, no two of which are parallel.

Example

Input:
4
-1 1
-2 0
0 0
1 1
0

Output:
4

Bessie can draw lines of the following four slopes: -1, 0, ⅓, and 1.


Added by:Neal Wu
Date:2008-10-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO
Resource:USACO Feb 2008

hide comments
2013-06-07 08:59:47 Yash Kumar Sharma
@rajeev Try Compiling on 4.3.2 at your machine
2013-06-07 06:54:54 rajeev bhardwaj
I have compiled and run my program in gcc 4.7.3 but showing compilation error in yours gcc 4.3.2. What to do ?
2013-03-09 09:26:26 Naveen Kumar Singh
std::sort() works here
2012-12-13 10:11:13 DINESH JANGID
some tricky test cases plz...getting WA again and again
2012-06-25 07:19:27 hamza007
For all those who are being troubled with repeated WA's ... Try sorting using your own sort function instead of std::sort().. Rest all being correct , sorting doubles using std::sort() was giving WA in my case ...
2012-01-06 07:48:21 SIGABRT
INF and -INF are same.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.