Veshy is taking a class in linear algebra! He comes across a problem about the rotations of points with respect to the origin. However, he deems this too trivial so he comes up with the following problem instead:
Veshy chooses two points located at integer coordinates, and , on the 2D plane. There is initially a token at . Veshy also has a sequence of points, all located at integer coordinates, on this plane, . One operation is defined as choosing some index and rotating the token an arbitrary angle around . However, if Veshy previously performed an operation on index , he only allowed to perform an operation on index such that . Determine if it's possible to move the token from to , and if so, the minimum number of operations required.
In all subtasks,
The absolute value of all coordinates will be less than or equal to
Subtask 1 [5% of points]
Subtask 2 [10% of points]
Subtask 3 [25% of points]
Subtask 4 [60% of points]
No additional constraints.
The first line contains one integer, .
The second line contains two space-separated integers, and , the coordinates of point .
The third line contains two space-separated integers, and , the coordinates of point .
The next lines contain two space-separated integers, and the coordinates of point .
Output one line containing one integer, the minimum number of operations if it's possible and
3 0 0 4 0 1 0 2 3 3 0
Explanation for Sample Output
One sequence of operations would be to rotate the token around and then another around . This sequence is shown in green. This would require two operations.
Another sequence would be rotating the token counter-clockwise around . This sequence is shown in blue. This would require one operation and it can be shown that there is no shorter sequence.