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

#CC0000053. Đếm số điểm được phủ đúng K lần (Covered Points Count)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Đếm số điểm được phủ đúng K lần (Covered Points Count)

Covered Points Count

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn inclusive integer-coordinate segments, possibly identical or reduced to single points. For every kk from 1 through nn, count integer coordinates covered by exactly kk segments.

Input

The first line contains nn. Each of the following nn lines contains an inclusive interval [li,ri][l_i,r_i].

Output

Print the nn counts cnt1,cnt2,…,cntncnt_1,cnt_2,\ldots,cnt_n.

Subtasks

  • Subtask 1 (20 points): 1≤n≤201\le n\le20; 0≤li≤ri≤10180\le l_i\le r_i\le10^{18}.
  • Subtask 2 (30 points): 1≤n≤15001\le n\le1500; 0≤li≤ri≤10180\le l_i\le r_i\le10^{18}.
  • Subtask 3 (50 points): 1≤n≤2000001\le n\le200000; 0≤li≤ri≤10180\le l_i\le r_i\le10^{18}.

Examples

Input

3
0 3
1 3
3 8

Output

6 2 1

Explanation

Coordinates 0,4,5,6,7,8 have coverage one; 1,2 have coverage two; and coordinate 3 has coverage three.