Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.

During an audit, you were surprised to find out that the items are not numbered sequentially, and some items even share the same inventory number! There is an urgent need to fix it. You have chosen to make the numbers of the items sequential, starting with 1. Changing a number is quite a time-consuming process, and you would like to make maximum use of the current numbering.

You have been given information on current inventory numbers for n items in the company. Renumber items so that their inventory numbers form a permutation of numbers from 1 to n by changing the number of as few items as possible. Let us remind you that a set of n numbers forms a permutation if all the numbers are in the range from 1 to n, and no two numbers are equal.


-----Input-----

The first line contains a single integer n — the number of items (1 ≤ n ≤ 10^5).

The second line contains n numbers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^5) — the initial inventory numbers of the items.


-----Output-----

Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.


-----Examples-----
Input
3
1 3 2

Output
1 3 2 

Input
4
2 2 3 3

Output
2 1 3 4 

Input
1
2

Output
1 



-----Note-----

In the first test the numeration is already a permutation, so there is no need to change anything.

In the second test there are two pairs of equal numbers, in each pair you need to replace one number.

In the third test you need to replace 2 by 1, as the numbering should start from one.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
lst = [int(x) for x in input().split()]
tmp = [False] * 100007
tmp2 = [False] * 100007

for x in lst:
	tmp[x] = True



answer, index = [], 1
for x in lst:
	if not tmp2[x] and x <= len(lst):
		answer.append(x)
		tmp2[x] = True
	else:
		while tmp[index]:
			index += 1
		tmp[index] = True
		answer.append(index)


print(' '.join(map(str, answer)))

n = int(input())
a = [int(x)-1 for x in input().split()]
count = [0 for i in range(len(a))]
ans = [-1 for i in range(len(a))]
for i in range(len(a)):
	if a[i] < len(count):
		count[a[i]] += 1

for i in range(len(a)):
	if a[i] < len(count):
		if count[a[i]] >= 1:
			ans[i] = a[i]
			count[a[i]] = -1

jIt = 0
for i in range(len(ans)):
	if ans[i] == -1:
		while count[jIt] < 0:
			jIt += 1
		ans[i] = jIt
		jIt += 1

print(" ".join(str(x+1) for x in ans))

def main():
    n = int(input())
    a = [int(i) for i in input().split()]

    d = [0] * n
    for i in range(n):
        if a[i] > n or d[a[i] - 1] == 1:
            a[i] = -1
        else:
            d[a[i] - 1] = 1
    for s in range(n):
        if d[s] == 0:
            break
    for i in a:
        if i == -1:
            print(s + 1, end=' ')
            for s in range(s + 1, n):
                if d[s] == 0:
                    break
        else:
            print(i, end=' ')
            
main()


n = int(input())
a = list(map(int, input().split()))
c = [0] * 100000
for i in range(n):
    c[a[i] - 1] += 1
s = []
for i in range(n):
    if c[i] == 0:
        s.append(i + 1)
if not s:
    print(*a)
    return
ans = a[:]
x = 0
for i in range(n):
    if c[a[i] - 1] > 1 or a[i] > n:
        c[a[i] - 1] -= 1
        ans[i] = s[x]
        x += 1
print(*ans)

n = int(input())

nums = [False] * n
seen = [False] * n
i = 0
A = list(map(int, input().split()))

# First walk
for num in A:
    if 1 <= num <= n:
        nums[num - 1] = True

# Second walk
for num in A:
    if 1 <= num <= n:
        if not seen[num - 1]:
            seen[num - 1] = True
            print(num, end = " ")
        else:
            while nums[i]:
                i += 1
            nums[i] = True
            i += 1
            print(i, end = " ")
    else:
        while nums[i]:
            i += 1
        nums[i] = True
        i += 1
        print(i, end = " ")

n = int(input())
a = input().split()
d = {}
for i in range(n):
    d[i+1] = 0
for i in range(n):
    a[i] = int(a[i])
    if not a[i] in d:
        d[a[i]] = 1
    else:
        d[a[i]] += 1
nls_pos = []
for i in range(n):
    if d[i+1] == 0:
        nls_pos.append(i+1)
for i in range(n):
    if d[a[i]] > 1 or a[i]>n:
        d[a[i]] -= 1
        a[i] = nls_pos[-1]
        nls_pos.pop()
for i in a:
    print(i, end=" ")

N = int(input())
things = list(map(int, input().split()))
ans = []
dif = set(things)
double = set()
to_zen = []
pnt = 0
for i in things:
    if i > N:
        dif.discard(i)
        to_zen += [pnt]
    elif i in double:
        to_zen += [pnt]
    double.add(i)
    pnt += 1
for i in range(1, N + 1):
    if i not in dif:
        things[to_zen.pop()] = i
        dif.add(i)
print(' '.join(list(map(str, things))))

def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in range(N)]

N = read_line(int)
A = read_list(int)
unused = list(set(range(1, N+1)) - set(A))
cur = 0
used = [False] * (N+1)

for i, a in enumerate(A):
    if a > N or used[a]:
        A[i] = unused[cur]
        used[A[i]] = True
        cur += 1
    else:
        used[a] = True
print(*A)


n = int(input())
a = [int(i) for i in input().split()]
c = [0] * (n+1)

for e in a:
    if e <= n:
        c[e] = 1
l = [e for e in range(1,n+1) if c[e] == 0]

s = 0
c = [0] * (n+1)
for i in range(n):
    if a[i] <= n and c[a[i]] < 1:
        c[a[i]] = 1
    else:
        a[i] = l[s]
        s += 1

for e in a:
    print(e, end = ' ')
            
        


n = int(input())
pin = input().split(" ")
arr = [int(i)-1 for i in pin]
free = [True]*n
change = []
for i in range(n):
    if arr[i] <n:
        if free[arr[i]]:
            free[arr[i]] = False
        else:
            change.append(i)        
    else:
        change.append(i)
        
for i in range (n):
    if free[i]:
        arr[change.pop()] = i

for i in arr:
    print (i+1, end=" ")

import sys


n = int(input())
x = str(input()).split()
a = {a : 1 for a in range(1, n + 1)}
c = []

for i in range(n):
    if int(x[i]) > n:
        c.append(i)
        continue
    if a.get(int(x[i])) == 1:
        a.pop(int(x[i]))
        continue
    else:
        c.append(i)

for i in range(len(c)):
    x[c[i]] = a.popitem()[0]

for i in range(n - 1):
    print(x[i], end=" ")
print(x[n - 1])


n = int(input())

things_numbers = list(map(int, input().split()))
things_numbers_set = set(things_numbers)
is_not_free = set()

j = 1
for i in range(0, n):
    if things_numbers[i] not in is_not_free and things_numbers[i] <= n:
        is_not_free.add(things_numbers[i])
    else:
        while j in things_numbers_set:
            j += 1
        things_numbers[i] = j
        j += 1

print(*things_numbers)

import sys

n = int(sys.stdin.readline())
things = list(map(int, sys.stdin.readline().split()))

#maxnum = max(things)
lastnum = 1
count = [0] * (n + 1)
for num in things:
    if num <= n:
        count[num] = 1

for num in things:
    if num > n or count[num] > 1:
        while count[lastnum]:
            lastnum += 1
        count[lastnum] = 1
        sys.stdout.write(str(lastnum) + ' ')
    else:
        count[num] = 2
        sys.stdout.write(str(num) + ' ')

from collections import Counter

n = int(input())
A = list(map(int, input().split()))

def change():
    set_list = set(A)
    for i in range(1, n + 1):
        if i not in set_list:
            yield i
            
C = Counter(A)        
ch = change()
for i in range(n):
    if C[A[i]] > 1:
        C[A[i]] -= 1
        A[i] = next(ch)
    elif A[i] > n:
        A[i] = next(ch)

for i in A:
    print(i, end = ' ')

n = int(input())
lst = list(map(int, input().split()))
mn = set()
ans = set()
sp = []
for i in range(1, n + 1):
    mn.add(i)
for i in lst:
    if i in mn:
        mn.remove(i)
for i in lst:
    if i in ans or i > n:
        a = mn.pop()
        ans.add(a)
        sp.append(a)
    if i not in ans and i <= n:
        ans.add(i)
        sp.append(i)
    
print(*sp)    


n = int(input())

a = [int(i) for i in input().split(' ')]

m = {}

for i in range(1, 100001):
    m[i] = []

zeroIndexes = []

for i in range(n):
    m[a[i]].append(i)

for i in range(1, n+1):
    if len(m[i])==0:
        zeroIndexes.append(i)

for i in range(1, 100001):
    if len(m[i])==0: continue
    mx = 1 if i<=n else 0
    while len(m[i])>mx:
        a[m[i][-1]] = zeroIndexes[-1]
        m[i].pop()
        zeroIndexes.pop()

print(' '.join([str(s) for s in a]))

def main():
    read = lambda: map(int, input().split())
    
    n = int(input())
    a = list(read())
    used = [True] * (n + 1)
    C = {i + 1 for i in range(n)}    
    A = {i for i in a if i <= n}
    B = A ^ C
    for i in a:
        if i > n or not used[i]:
            print(B.pop(), end = ' ')
        else:
            print(i, end = ' ')
            used[i] = False
main()

n = int(input())
nums = list(map(int, input().strip().split(' ')))

snums = sorted(enumerate(nums), key=lambda x: x[1])

bonus = set()
holes = set()
skip = set()
count = 1

for i, v in snums:
    if v < count or v > n:
        bonus.add(i)
    if v == count:
        count += 1
    elif v > count:
        holes.update(j for j in range(min(n+1, count), min(n+1, v)))
        count = v + 1

while len(bonus) > 0 and len(holes) > 0:
    idx = bonus.pop()
    x = holes.pop()
    nums[idx] = x
    skip.add(idx)

if len(holes) == 0:
    last = snums[-1][1] + 1
    for i in bonus:
        nums[i] = last
        last += 1
else:
    assert(len(bonus) == 0)
    for i, v in snums[::-1]:
        if i in skip:
            continue
        if len(holes) == 0:
            break
        x = holes.pop()
        nums[i] = x

print(' '.join([str(x) for x in nums]))


num = int(input())
list1 = input().split(' ')

inv = set()

for i in list1:
    inv.add(int(i))
    
missing = []
notE = []

for i in range(1,num+1):
    if i not in inv:
        missing.append(i)

written = set()

j = 0

for i in range(len(list1)):
    if list1[i] in written or int(list1[i])>num:
        list1[i] = str(missing[j])
        written.add(list1[i])
        j += 1
    else:
        written.add(list1[i])
        
        
print(*list1)


n = int(input())
inp = list(map(int,input().split(' ')))
used = set(inp)
seen = set()
toadd = set(i+1 for i in range(n) if i+1 not in used)
res = []
for num in inp:
    if num < 1 or num > n or num in seen:
        num = toadd.pop()
    else:
        seen.add(num)
    res.append(num)
print(*res)

n = int(input())
box = list(map(int, input().split()))
used = [False for i in range(n)]
accepted = [False for i in range(n)]
j = 0
for i in box:
    if i <= n and not used[i - 1]:
        accepted[j] = True
        used[i - 1] = True
    j += 1
j = 0
for i in range(n):
    if not accepted[i]:
        while used[j] != False:
            j += 1
        j += 1
        print(j, end=' ')
    else:
        print(box[i], end=' ')
        

n = int(input())
inp = list(map(int,input().split(' ')))
used = set(inp)
seen = set()
toadd = {i+1 for i in range(n)}.difference(used)
res = []
for num in inp:
    if num < 1 or num > n or num in seen:
        num = toadd.pop()
    else:
        seen.add(num)
    res.append(num)
print(*res)

n = int(input())
a = list(map(int, input().split()))
c = [0] * (100001)
for ai in a:
    c[ai] += 1
b = [x for x in range(1, n + 1) if c[x] == 0]
j = 0
for i, ai in enumerate(a):
    if c[ai] > 1 or ai > n:
        a[i] = b[j]
        j += 1
        c[ai] -= 1
print(' '.join(map(str, a)))

n = int(input())
inp = list(map(int,input().split(' ')))
used = set(x for x in inp if x > 0 and x <= n)
toadd = {i+1 for i in range(n)}.difference(used)
res = []
for num in inp:
    if num in used:
        used.remove(num)
    else:
        num = toadd.pop()
    res.append(num)
print(*res)