Rearrange An Array Such That Arr[i] = I

easy
1. You will be given an array of n-1 elements, not all elements will be present, 2. If a number is not present, print -1. For others, print i against a[i] 3. Input is handled for you 4. It is a functional problem ,please do not modify main()

Input Format

Input is handled for you.

Output Format

Print required output

Constraints

1<=N<=1000
  0<=A[i]<=N-1

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
8
5 -1 3 6 -1 -1 1 0
Output
0 1 -1 3 -1 5 6 -1
Previous
Nearly Sorted Algorithm
Next
Pairs With Given Xor

Related Questions