AdvancedRating 1500
Burst the Balloons
Balloons span horizontal intervals [s, e]. An arrow shot at x bursts every balloon with s ≤ x ≤ e. Print the minimum number of arrows.
Input
n, then n lines 's e'.
Output
A count.
Sample 1
Input
4 10 16 2 8 1 6 7 12
Output
2
Sample 2
Input
4 1 2 3 4 5 6 7 8
Output
4
Output appears here