#KEYENCE2020B. Robot Arms

Robot Arms

Score : 200200 points

Problem Statement

In a factory, there are NN robots placed on a number line. Robot ii is placed at coordinate XiX_i and can extend its arms of length LiL_i in both directions, positive and negative.

We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each ii (1iN1 \leq i \leq N), the movable range of arms of Robot ii is the part of the number line between the coordinates XiLiX_i - L_i and Xi+LiX_i + L_i, excluding the endpoints.

Find the maximum number of robots that we can keep.

Constraints

  • 1N100,0001 \leq N \leq 100,000
  • 0Xi1090 \leq X_i \leq 10^9 (1iN1 \leq i \leq N)
  • 1Li1091 \leq L_i \leq 10^9 (1iN1 \leq i \leq N)
  • If iji \neq j, XiXjX_i \neq X_j.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

X1X_1 L1L_1

X2X_2 L2L_2

\vdots

XNX_N LNL_N

Output

Print the maximum number of robots that we can keep.

4
2 4
4 3
9 3
100 5
3

By removing Robot 22, we can keep the other three robots.

2
8 20
1 10
1
5
10 1
2 1
4 1
6 1
8 1
5