You are given an integer array of length \(N\). You have to find \(MEX\) of \(i^{th}\) element for all \(1 \leq i \leq N\).
\(MEX\) of the \(i^{th}\) element is the minimum element greater than or equal to \(0\) which is not present in array till the \(i^{th}\) 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. \(i^{th}\) element should be the \(MEX\) of the array prefix till \(i\)
Constraints:
\(1 \leq N \leq 2*10^5 \\ 0 \leq arr[i] \leq 2*10^5 \)
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.