1683 - [Usaco2005 Nov]City skyline 城市地平线

Input

第1行:2个用空格隔开的整数N和W.

第2到N+1行:每行包括2个用空格隔开的整数x,y,其意义如题中所述.输入中的x严格递增,并且第一个z总是x.

Output

输出一个整数,表示城市中最少包含的建筑物数量.

Examples

Input

10 26
1 1
2 2
5 1
6 3
8 1
11 0
15 2
17 3
20 2
22 1

INPUT DETAILS:

The case mentioned above

Output

6
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题