E. Connected Components
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

There are $$$n$$$ kingdoms on the continent of Eminor numbered from $$$1$$$ to $$$n$$$. Each kingdom has two attribute values represented by $$$a_i$$$ and $$$b_i$$$.

Kingdom $$$i$$$ and $$$j$$$ ($$$i \lt j$$$) are connected by an undirected road when $$$a_i - a_j \leq i - j \leq b_i - b_j$$$, or $$$a_j - a_i \leq j - i \leq b_j - b_i$$$.

Gew wants to know how many connected components are in this continent.

Input

The first line contains a single integer $$$n$$$ ($$$1\leq n\leq 10^6$$$).

The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$a_i, b_i$$$ ($$$-10^9 \leq a_i, b_i \leq 10^9$$$)

Output

Output a single integer, denoting the number of connected components.

Examples
Input
5
1 -4
3 -2
5 0
7 2
9 4
Output
5
Input
2
1 2
2 1
Output
1
Input
5
5 4
3 3
2 5
3 4
4 5
Output
2