1313. Flat broken lines

单点时限: 2.0 sec

内存限制: 256 MB

We have a cartesian coordinate system drawn on a sheet of paper. Let us consider broken lines that can be drawn with a single pencil stroke from the left to the right side of the sheet. We also require that for each segment of the line the angle between the straight line containing this segment and the OX axis belongs to [-45°,45°] range. A broken line fulfilling above conditions is called a flat broken line. Suppose we are given n distinct points with integer coordinates. What is the minimal number of flat broken lines that should be drawn in order to cover all the points (a point is covered by a line if it belongs to this line)?

Example

For 6 points whose coordinates are (1,6), (10,8), (1,5), (2,20), (4,4), (6,2) the minimal number of flat broken lines covering them is 3.

Task

Write a program that:

1.reads the number of points and their coordinates;

2.computes the minimal number of flat broken lines that should be drawn to cover all the points;

3.writes the result.

输入格式

In the first line there is one positive integer n, not greater than 30000, which denotes the number of points. In the following n lines there are coordinates of points. Each line contains two integers x, y separated by a single space, 0 <= x <= 30000, 0 <= y <= 30000. The numbers in the (i+1)-st line, 1 <= i <= n, are the coordinates of the i-th point.

输出格式

writes the result in a single line.

样例

Input
6
1 6
10 8
1 5
2 20
4 4
6 2
Output
3

4 人解决,8 人已尝试。

5 份提交通过,共有 43 份提交。

8.4 EMB 奖励。

创建: 17 年,3 月前.

修改: 7 年,2 月前.

最后提交: 1 年,4 月前.

来源: POI 1998 III Stage

题目标签