# Concentric Rings

Time Limit: Java: 2000 ms / Others: 2000 ms

Memory Limit: Java: 65536 KB / Others: 65536 KB

## Description

There are several different concentric rings on the ground. Some of them may overlap. In Figure 1, there are 3 rings: blue, green and red. The red one is just above the green one. The problem is to remove minimum number of rings so that no two of the remaining overlap.

Figure 1

## Input

The input consists of multiple test cases. Each test case starts with a positive integer N (<=10000) which represents the number of rings. The next N lines each line contains two positive integers which represents the inner radius and outer radius respectively.

## Output

For each test case, output the minimum number of rings to remove.

## Sample Input

3
1 2
3 6
4 5

## Sample Output

1

None

## Source

CYJJ's Funny Contest #1, Killing in Seconds