LearnPy Hub
← Arena
AdvancedRating 1700

Nesting Envelopes

An envelope fits inside another if both its width and height are strictly smaller. Print the most envelopes you can nest one inside another.

Input

n; then n lines 'w h'.

Output

One integer.

Sample 1

Input
4
5 4
6 4
6 7
2 3
Output
3

Sample 2

Input
3
1 1
1 1
1 1
Output
1
solution.py
Output appears here
Nesting Envelopes · Python Arena problem · LearnPy Hub