You are given an integer array of length N. You have to find MEX of ith element for all 1≤i≤N.
MEX of the ith element is the minimum element greater than or equal to 0 which is not present in array till the ith index.
Input Format:
First line contains an integer N denoting the size of array.
Next line contains N integers denoting the elements of the array.
Output Format:
Print N integers. ith element should be the MEX of the array prefix till i
Constraints:
1≤N≤2∗1050≤arr[i]≤2∗105
For first test case mex of first index is 0. As it is note present in array
mex of second index is 2 as 0 and 1 is present in array.
mex of 3rd, 4th and 5th index is 2.