403790: GYM101306 C Art Museum

Memory Limit:64 MB Time Limit:6 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Art Museumtime limit per test6 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output

EPFL (Extreme Programmers For Life) want to build their 57th art museum. This museum would be better, bigger and simply more amazing than the last 56 museums. This would make EPFL great again.

To achieve this, EPFL will not only require the help of top-notch Japanese architects, but also of all Martians. However, the Martians are spread across several galaxies and therefore have different time availabilities. You thought the time difference between Europe and USA was annoying?

Help EPFL find the maximum number of galaxies that are available at the same hour?

Input

The first line contains the integer n, the number of galaxies (1 ≤ n ≤ 105).

On each of the next n lines, there will be two space-separated integers, a and b (0 ≤ a < b ≤ 24).

This means that the Martians of this galaxy are available from the beginning of the a-th hour to the beginning of the b-th hour.

Output

Print the maximum number of galaxies available in any timeslot of one hour.

ExamplesInput
2
1 14
14 21
Output
1
Input
7
9 16
16 18
5 12
15 24
9 20
20 22
23 24
Output
3
Note

In the first example, the Martians of the first galaxy are available from 01:00 to 14:00, and the Martians of the second galaxy are available from 14:00 to 21:00. Therefore, at any given hour, the maximum number of available galaxies is 1.

In the second example, the timeslots in which 3 galaxies are available are: 9:00 - 12:00, 15:00 - 16:00, and 16:00 - 18:00. No one-hour timeslot has more than 3 galaxies available. Therefore, the answer is 3.

加入题单

上一题 下一题 算法标签: