#jag2018summerday2f. [jag2018summer_day2_f]Point Sequences
[jag2018summer_day2_f]Point Sequences
Problem Statement
Takahashi-kun sends integer sequences to Aoki-kun every year as his birthday present. But in this year, Takahashi-kun plans to send sequences of points on a two-dimensional plane to Aoki-kun.
Firstly, he makes point sequences: , , and , and makes a point . Then he makes the points in this order as follows:
- For each , is defined as the intersection point of two lines: the line that passes through and , and the line that passes through and .
It can happen that a point can not be defined for some . For example, when two lines are the same, there are an infinite number of intersection points.
Takahashi-kun wants to know the smallest such that can not be defined. To be precise, can not be defined if either of the following conditions is met.
- two lines given by , , , and are the same, or parallel.
It is guaranteed that for all .
Note that, in the following sections, - and - coordinates of a point are denoted as and , respectively.
Constraints
- $|a_i.x|, |a_i.y|, |b_i.x|, |b_i.y|, |c_i.x|, |c_i.y| \\leq 1,000$
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the smallest such that can not be defined. If all points are defined, print .
Sample Input 1
6
0 0
10 -10 10 10 10 0
0 10 20 10 10 10
0 -10 0 -100 0 10
0 0 0 -100 0 0
0 0 0 1 0 0
31 14 15 92 65 35
Sample Output 1
3
Sample Input 2
11
0 0
299 0 299 1 3 1
1 0 1 1 300 100
299 0 299 1 3 1
1 0 1 1 300 100
299 0 299 1 3 1
1 0 1 1 300 100
299 0 299 1 3 1
1 0 1 1 300 100
299 0 299 1 3 1
1 0 1 1 300 100
0 0 3 1 3 1
Sample Output 2
10