Max Points on a Line

HardHashing
Next
GeometryHash MapMath

Given distinct points on a 2D plane, find the largest number of points that lie on the same straight line.

Input

Line 1: n, the number of points. Next n lines: the integer coordinates x and y of each point.

Output

Print the maximum number of points on one line.

Constraints

1 <= n <= 300 -10^4 <= x, y <= 10^4 All points are distinct.

Example 1
Input
3
1 1
2 2
3 3
Output
3

All three points lie on y = x.

Example 2
Input
6
1 1
3 2
5 3
4 1
2 3
1 4
Output
4

Four points lie on the line x + y = 5.

Hints

Max Points on a Line - Hard Hashing Problem | Skill Shiksha