Recording the Moolympics

No attempts yetTime limit1sMemory limit128 MB

Problem

Farmer John likes every cold-weather sport, and he likes the events with cows in them most of all. So he wants to record as much of this winter's Moolympics as he can.

The Moolympics broadcast schedule has NN programs, and every program has a fixed start time and end time. Farmer John's recorder has two tuners, so he can record two programs at the same time. A single tuner cannot record two programs whose times overlap, but it can go straight on to a program that starts at the exact moment the previous one ends.

Write a program that finds the largest number of programs Farmer John can record.

Input

The first line contains the number of programs NN (1N1501 \le N \le 150).

Each of the next NN lines contains the start time and the end time of one program, separated by a space. Both values are integers between 00 and 10910^9.

Output

Print the largest number of programs Farmer John can record.