Task DescriptionDiscussion (0)

The first line of the standard input contains the number 0<

To the standard output write one number that is the maximum number of people that were at the party at the same discrete interval (moment).

Input:

Output:

Explanation: At interval 3, persons 1, 2 and 3 were at the party.

Task :: z-policajac

Mr. Little Z has found a job as a security guard, and his first assignment is to preserve the peace at a big New Year's party in Belgrade Arena. Unfortunately, irresponsible Mr. Little Z fell asleep right after he arrived. Now he has to read a report to his boss about the maximum number of people that were at the party at one time. Mr. Little Z decided to phone everyone who was at the party and ask them their exact time of arrival and departure from the party. The duration of the party Mr. Little Z represented by 1000000 discrete time intervals (he wants to be accurate).

Help Mr. Little Z give an accurate report that tells the maximum number of people that were at the party at one time.

**INPUT:**

The first line of the standard input contains the number 0<

**N**<=10000, where

**N**corresponds to the number of people that attended the party. In the next

**N**lines there are two numbers

**A**and

_{i}**B**, where

_{i}**A**represents the interval in range [1..1000000] when the

_{i}**i**-th guest arrived at the party and

**B**represents the interval in range [1..1000000] when the

_{i}**i**-th guest left the party. That means the

**i**-th person was at the party in the interval between

**A**and

_{i}**B**, including intervals

_{i}**A**and

_{i}**B**.

_{i}**OUTPUT:**

To the standard output write one number that is the maximum number of people that were at the party at the same discrete interval (moment).

Input:

**4**

1 3

2 3

3 4

5 7

1 3

2 3

3 4

5 7

Output:

**3**

Explanation: At interval 3, persons 1, 2 and 3 were at the party.

Submit Solution

Available Languages

Task info

Name: | z-policajac |

Time: | 0.5 sec. |

Memory: | 16 MB |

#Tests: | 20 |

Author: | Z |

AddedBy: | admin |

Task Ratings

Difficulty: | 3.6 (70 votes) |

Quality: | 4 (54 votes) |

Acceptance Rate

Recent Submissions

Fastest Solutions

User | Time |
---|---|

AlgorithmTeam | 0.012 s. |

A.Armin | 0.014 s. |

hadzem | 0.014 s. |

ja_bre | 0.015 s. |

illusion | 0.015 s. |

AppexX | 0.015 s. |

bl4ck.c0d3r | 0.017 s. |

mferencevic | 0.024 s. |

salleTKD | 0.024 s. |

micka93 | 0.033 s. |

Solved By