PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#CC0000073. Khách trong nhà hàng (Restaurant Customers)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

2 lộ trình

Khách trong nhà hàng (Restaurant Customers)

Restaurant Customers

Source: CSES

Version: Phuoc Hung OJ Extended

Problem Statement

A restaurant records the arrival time aia_i and departure time bib_i of each customer. Find the largest number of customers present at any time. All arrival and departure times are distinct.

Input

The first line contains nn, followed by nn lines each containing ai,bia_i,b_i.

Output

Print the maximum number of concurrent customers.

Subtasks

  • Subtask 1 (20 points): 1≤n≤201\le n\le 20; 1≤ai<bi≤1091\le a_i<b_i\le10^9; all 2n2n time values are distinct.
  • Subtask 2 (30 points): 1≤n≤20001\le n\le 2000; 1≤ai<bi≤1091\le a_i<b_i\le10^9; all 2n2n time values are distinct.
  • Subtask 3 (50 points): 1≤n≤2000001\le n\le 200000; 1≤ai<bi≤1091\le a_i<b_i\le10^9; all 2n2n time values are distinct.

Examples

Input

3
5 8
2 4
3 9

Output

2

Explanation

The second customer stays from time 22 to 44; the third stays from 33 to 99. Between 33 and 44, two customers are present, which is the maximum.