시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB91565460.674%

문제

There are $N$ residents in JOI Kingdom, numbered from $1$ to $N$. Resident $i$ ($1 ≤ i ≤ N$) lives at the coordinate $X_i$ on the real line, and its power of influence is $E_i$. It may be the case that more than one residents live at the same coordinate. A resident with a large power of influence has a high advertising potential. But such a resident is careful in buying books.

Rie published a book on informatics. In order to encourage many people to buy copies of the book, she can donate copies of the book to some residents. If she donates a copy of the book to Resident $i$ ($1 ≤ i ≤ N$), Resident $i$ will get a copy of Rie’s book. Moreover, among the residents who did not yet get copies of the book, every resident $j$ ($1 ≤ j ≤ N$) satisfying the following condition will buy a copy of the book and get it.

The distance between Resident $i$ and Resident $j$ on the real line is less than or equal to $E_i - E_j$. In other words, $|X_i - X_j| ≤ E_i - E_j$ is satisfied.

If all the residents read Rie’s book, the Olympiads in Informatics will be greatly recognized. Write a program which calculates the minimum number of residents who will be donated copies of Rie’s book so that all the residents in JOI Kingdom will get copies of Rie’s book.

입력

Read the following data from the standard input.

$N$

$X_1$ $E_1$

$X_2$ $E_2$

$\vdots$

$X_N$ $E_N$

출력

Write one line to the standard output. The output should contain the minimum number of residents who will be donated copies of Rie’s book.

제한

  • $1 ≤ N ≤ 500\,000$.
  • $1 ≤ X_i ≤ 10^9$ ($1 ≤ i ≤ N$).
  • $1 ≤ E_i ≤ 10^9$ ($1 ≤ i ≤ N$).
  • Given values are all integers.

서브태스크

번호배점제한
110

$E_1 = E_2 = \cdots = E_N$.

223

$N ≤ 16$.

336

$N ≤ 1\,000$.

431

No additional constraints.

예제 입력 1

4
4 2
2 3
3 4
6 5

예제 출력 1

2

For example, if Rie donates copies of the book in the following way, all the residents in JOI Kingdom will get copies of Rie’s book.

  • Rie donates a copy of the book to Resident $3$.
    • Since $|X_3 - X_1| = 1$ and $E_3 - E_1 = 2$, Resident $1$ will buy a copy of Rie’s book and get it.
    • Since $|X_3 - X_2| = 1$ and $E_3 - E_2 = 1$, Resident $2$ will buy a copy of Rie’s book and get it.
    • Since $|X_3 - X_4| = 3$ and $E_3 - E_4 = -1$, Resident $4$ will not buy a copy of Rie’s book.
    • Therefore, Residents $1$, $2$, $3$ will get copies of Rie’s book.
  • Rie donates a copy of the book to Resident $4$. Since all the residents except Resident $4$ already got copies of Rie’s book, all the residents in JOI Kingdom finally get copies of Rie’s book.

Since it is impossible to donate copies of the book to less than two residents so that all the residents in JOI Kingdom will get copies of Rie’s book, output $2$.

This sample input satisfies the constraints of Subtasks 2, 3, 4.

예제 입력 2

3
7 10
10 10
7 10

예제 출력 2

2

This sample input satisfies the constraints of all the subtasks.

예제 입력 3

10
31447678 204745778
430226982 292647686
327782937 367372305
843320852 822224390
687565054 738216211
970840050 766211141
563662348 742939240
103739645 854320982
294864525 601612333
375952316 469655019

예제 출력 3

5

This sample input satisfies the constraints of Subtasks 2, 3, 4.

채점 및 기타 정보

  • 예제는 채점하지 않는다.