AT_abc408_c [ABC408C] Not All Covered

Description

In the AtCoder Kingdom, there are $ N $ castle walls numbered from $ 1 $ through $ N $ . There are also $ M $ turrets. Turret $ i $ guards castle walls numbered from $ L_i $ through $ R_i $ . When a turret is destroyed, the castle walls that were guarded by that turret are no longer guarded by that turret. What is the minimum number of turrets that need to be destroyed so that at least one castle wall is not guarded by any turret?

Input Format

The input is given from Standard Input in the following format: > $ N $ $ M $ $ L_1 $ $ R_1 $ $ L_2 $ $ R_2 $ $ \vdots $ $ L_M $ $ R_M $

Output Format

Output the minimum number of turrets that need to be destroyed so that at least one castle wall is not guarded by any turret.

Explanation/Hint

### Sample Explanation 1 If turret $ 1 $ is destroyed, no turret guards castle wall $ 3 $ . Also, if no turrets are destroyed, all castle walls are guarded by some turret. Therefore, output $ 1 $ . ### Sample Explanation 2 Since no turret guards castle wall $ 5 $ , there already exists a castle wall not guarded by any turret without destroying any turrets. Therefore, output $ 0 $ . ### Constraints - $ 1 \leq N \leq 10^6 $ - $ 1 \leq M \leq 2 \times 10^5 $ - $ 1 \leq L_i \leq R_i \leq N $ ( $ 1 \leq i \leq M $ ) - All input values are integers.