#hhkb2020c. [hhkb2020_c]Neq Min

[hhkb2020_c]Neq Min

Problem Statement

Given is a number sequence of length NN: p1,...,pNp_1, ..., p_N.

For each i=1,2,...,Ni=1, 2, ..., N, find the minimum non-negative integer that is not equal to any of the numbers p1,...,pip_1, ..., p_i.

Constraints

  • 1leqNleq200,0001 \\leq N \\leq 200,000
  • 0leqpileq200,0000 \\leq p_i \\leq 200,000
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN p1p_1 ...... pNp_N

Output

Print NN lines in total.

The ii-th line (1leqileqN1 \\leq i \\leq N) should contain the minimum non-negative integer that is not equal to any of the numbers p1,...,pip_1, ..., p_i.


Sample Input 1

4
1 1 0 2

Sample Output 1

0
0
2
3
  • The minimum non-negative integer that is not equal to p1=1p_1=1 is 00.
  • The minimum non-negative integer that is not equal to any of p1=1,p2=1p_1=1, p_2=1 is 00.
  • The minimum non-negative integer that is not equal to any of p1=1,p2=1,p3=0p_1=1, p_2=1, p_3=0 is 22.
  • The minimum non-negative integer that is not equal to any of p1=1,p2=1,p3=0,p4=2p_1=1, p_2=1, p_3=0, p_4=2 is 33.

Sample Input 2

10
5 4 3 2 1 0 7 7 6 6

Sample Output 2

0
0
0
0
0
6
6
6
8
8