LearnPy Hub
← Arena
IntermediateRating 1200

Most Activities

Choose the maximum number of non-overlapping activities [start, end] (an activity may start when the previous ends). Print the count.

Input

n, then n lines 'start end'.

Output

A count.

Sample 1

Input
6
1 2
3 4
0 6
5 7
8 9
5 9
Output
4

Sample 2

Input
1
0 10
Output
1
solution.py
Output appears here
Most Activities · Python Arena problem · LearnPy Hub