Banjo

No attempts yetTime limit5sMemory limit128 MB

Problem

One day Bajtazar went to the market square in Bajtogród to play the banjo. So as not to bother the nearby residents too much, he decided to play only two short one-minute songs. Even so, Bajtazar wanted as many people as possible to hear him, so he played one song, waited a little while, and then played the second one. Now he wonders whether, by chance, even more people could have heard his performance.

During the day, nn people passed through the square, numbered from 11 to nn. Person number ii arrived at the square exactly at the start of minute pip_i (counting from dawn) and left the square at the start of minute kik_i.

Bajtazar would like to compute how many people at most could hear him play if he started his performances at the best possible moments. This task, however, exceeded his arithmetic skills, since a day here lasts 10910^9 minutes. Please help him.

Assume Bajtazar plays exactly twice, each time for one minute. Each performance may start at any time; in particular, the second song may start right after the first one ends. A given person hears a performance if they are present in the square for the entire minute during which Bajtazar plays.

Input

The first line contains a single integer nn (1n5000001 \le n \le 500\,000), the number of people who came to the square during the day. Each of the next nn lines describes one person: the ii-th of these lines contains two integers pip_i and kik_i (1piki1091 \le p_i \le k_i \le 10^9), meaning that person number ii arrived at the start of minute pip_i and left at the start of minute kik_i.

Output

Print a single line with the maximum number of distinct people who can hear Bajtazar's banjo performances.

Note

In the first sample above, Bajtazar can play his first song during minute 55, when persons 11, 22, and 44 are present, and his second song during minute 99, when persons 22, 33, and 77 are present. Together, 55 distinct people hear him play.