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.
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 a single integer, denoting the number of connected components.
51 -43 -25 07 29 4
5
21 22 1
1
55 43 32 53 44 5
2
| Name |
|---|


