#K49597. Maximum Number of Trains at the Station

    ID: 28677 Type: Default 1000ms 256MiB

Maximum Number of Trains at the Station

Maximum Number of Trains at the Station

You are given n trains, each with an arrival time ai and a departure time di. Your task is to determine the maximum number of trains present at the station simultaneously.

Formally, for each train i (where 1 ≤ i ≤ n), you are given an interval [ai, di]. You need to compute the maximum value of the sum \[ f(t) = \sum_{i=1}^{n} \mathbf{1}_{[a_i, d_i]}(t), \] where \(\mathbf{1}_{[a_i, d_i]}(t)\) is the indicator function that is 1 if t is within the interval [ai, di] and 0 otherwise.

Note: If an arrival time equals a departure time, the departure is processed first.

inputFormat

The first line contains a single integer n indicating the number of trains. Each of the following n lines contains two space-separated integers ai and di, representing the arrival and departure times of the i-th train respectively.

Input is read from standard input (stdin).

outputFormat

Output a single integer representing the maximum number of trains present at the station at any given time. The output should be written to standard output (stdout).

## sample
3
1 5
2 6
4 8
3