Programming is an art!#1976

Programming is an art!

2 seconds
256 megabytes
Very hard

When asked about his salary by attendees at the Winter School , Petr Mitrichev gave a tactful response:

– Compared to L – a lot, but compared to R – a little.

As for the identities of these mysterious L and R, Petr chose to remain discreet.

While thinking about what interesting topic to present at the Winter School in Kharkiv, Petr carefully considered various options, but quickly rejected most, as they were already well-known and previously discussed by others. As a true artist-programmer, he could not allow himself to choose just an ordinary subject.

I will talk about L and R – especially since it seems no one has talked about this yet, Petr thought, and began drafting his lecture plan and sketching problem diagrams. Fortunately, his company had a large supply of markers of different colors, which he used to draw his diagrams. If he was unsatisfied with part of a diagram, Petr would simply take a marker of another color and draw over the unsatisfactory section, covering it according to the new plan.

While reworking the diagrams in this way, he quickly realized this process itself could be an interesting problem.

A programmer uses markers of different colors to draw segments on a coordinate line. Given the left () and right () endpoints of each drawn segment, determine the maximum number of different colors that can appear in the final drawing. This number will be called the level of this artist-programmer.

Input

The first line of the input contains a natural number (1 \leq N \leq 300). The next lines each contain a pair of numbers and separated by a space (-10^9 \leq L_i < R_i \leq 10^9).

Output

Output a single number: the highest possible level of the artist-programmer.

Examples

Example 1

Loading
Loading