Sample Data for Stones Practice

Sample Input

7
2 1
6 2
3 4
6 7
7 3
7 5

Sample Output

2