One very well-known internet resource site (let's call it X) has come up with a New Year adventure. Specifically, they decided to give ratings to all visitors.

There are n users on the site, for each user we know the rating value he wants to get as a New Year Present. We know that user i wants to get at least a_{i} rating units as a present.

The X site is administered by very creative and thrifty people. On the one hand, they want to give distinct ratings and on the other hand, the total sum of the ratings in the present must be as small as possible.

Help site X cope with the challenging task of rating distribution. Find the optimal distribution.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 3·10^5) — the number of users on the site. The next line contains integer sequence a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^9).


-----Output-----

Print a sequence of integers b_1, b_2, ..., b_{n}. Number b_{i} means that user i gets b_{i} of rating as a present. The printed sequence must meet the problem conditions. 

If there are multiple optimal solutions, print any of them.


-----Examples-----
Input
3
5 1 1

Output
5 1 2

Input
1
1000000000

Output
1000000000

Difficulty: interview

Starter code:

Solutions:
import sys

n = int(sys.stdin.readline())
l = [int(x) for x in sys.stdin.readline().split(' ')]

ind = sorted(list(range(len(l))), key=lambda x: l[x])
h = l[ind[0]] - 1
for i in ind:
    if l[i] <= h:
        l[i] = h+1
        h += 1
    else:
        h = l[i]
print(" ".join([str(x) for x in l]))


dp = dict()

n = int(input())
a = list(map(int, input().split()))
g = sorted(list(range(n)), key = lambda x: a[x])
value = a[g[0]] - 1
for i in g:
    if a[i] <= value:
        a[i] = value + 1
        value += 1
    else:
        value = a[i]
print(' '.join(map(str, a)))


from operator import itemgetter
n = int(input())
a = list(map(int, input().split()))
b = sorted(enumerate(a), key=itemgetter(1))
for i in range(1, n):
  if a[b[i - 1][0]] >= a[b[i][0]]:
    a[b[i][0]] = a[b[i - 1][0]] + 1
print(' '.join(map(str, a)))

import sys
n = int(input())
a = list(map(int, sys.stdin.read().split()))
g = sorted(range(n), key=lambda x: a[x])
for i in range(1, n):
	if a[g[i]] <= a[g[i - 1]]:
		a[g[i]] = a[g[i - 1]] + 1
print(' '.join(map(str, a)))

i = int(input())
rat = list(map(int, input().split(' ')))
ratp = sorted(list(range(i)), key=lambda x: rat[x])
final = [-1] * i

start = 0
for i in ratp:
    if start + 1 >= rat[i]:
        start = start + 1
    else:
        start = rat[i]
        
    final[i] = start

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


def main():
    n = int(input())
    aa = list(map(int, input().split()))
    idx = sorted(list(range(n)), key=aa.__getitem__)
    b = 0
    for i in idx:
        aa[i] = b = max(b + 1, aa[i])
    print(' '.join(map(str, aa)))


def __starting_point():
    main()

__starting_point()

import operator

n = int(input())

a = list((v,k) for k,v in enumerate(map(int,input().split())))
a.sort(key=operator.itemgetter(0))
#print(a)

cur = 0
b = [0]*n

for i in range(n):
	x = a[i][0]
	if x > cur:
		cur = x + 1
		b[a[i][1]] = str(x)
	else:
		b[a[i][1]] = str(cur)
		cur += 1

#b = sorted(b,key=itemgetter(1))

print(' '.join(b))

n = int(input() )
a = list(map(int, input().split(' ')))
id = sorted(range(n), key=lambda x : a[x])
for i in range(1, n):
    if a[id[i]] <= a[id[i - 1]]:
        a[id[i]] = a[id[i - 1]] + 1
print(' '.join(map(str, a)))

n=int(input())
a=list(map(int, input().split(' ')))
id=sorted(range(n), key=lambda x: a[x])

for i in range (1,n):
	if a[id[i]] <= a[id[i-1]]:
		a[id[i]]=a[id[i-1]]+1
print (' '.join(map(str,a)))

n=int(input())
a=list(map(int, input().split()))
sortedIndex = sorted(range(n), key=lambda k: a[k])
temp=0
for i in range (n):
  if a[sortedIndex[i]] <= temp:
    a[sortedIndex[i]] = temp
    temp += 1
  elif a[sortedIndex[i]] > temp:
    temp = a[sortedIndex[i]] + 1

result = ' '.join(str(e) for e in a)
print(result)

i = int(input())
values = list(map(int, input().split(' ')))
result = [-1] * i
sortedValues = sorted(range(i), key=lambda x: values[x])

cnt = 0
for i in sortedValues:
    cnt = cnt + 1 if cnt + 1 >= values[i] else values[i]
    result[i] = cnt

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

import sys

def main():
    n = int(sys.stdin.readline())
    a = list(map(int, sys.stdin.readline().split(' ')))
    l = sorted(list(range(n)),key=lambda i: a[i])
    cur = a[l[0]]
    s = set([cur])
    for i in range(1, n):
        if a[l[i]] == cur or a[l[i]] in s:
            a[l[i]] = cur + 1
        cur = a[l[i]]
        s.add(cur)
    sys.stdout.write('{}\n'.format(' '.join(list([str(i) for i in a]))))

main()



n = int(input() )
a = list(map(int, input().split(' ')))
id = sorted(range(n), key=lambda x : a[x])
for i in range(1, n):
    if a[id[i]] <= a[id[i - 1]]:
        a[id[i]] = a[id[i - 1]] + 1
print(' '.join(map(str, a)))

import sys
n = int(input())
a = list(map(int, sys.stdin.read().split()))
g = sorted(list(range(n)), key=lambda x: a[x])
for i in range(1, n):
	if a[g[i]] <= a[g[i - 1]]:
		a[g[i]] = a[g[i - 1]] + 1
print(' '.join(map(str, a)))



# Made By Mostafa_Khaled


n=int(input().strip())
a=list(map(int,input().strip().split()))
t=sorted(list(range(n)),key=lambda x:a[x])

cur=-1
final=[0]*n
for elem in t:
    if cur + 1 >= a[elem]:
        cur+=1
    else:
        cur=a[elem]
    final[elem]=cur

print(' '.join(str(x) for x in final))




"""

3
5 1 1

1
1000000

"""


from collections import defaultdict
from queue import *

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

value_ind_map = defaultdict(list)
# for i in range(len(ratings)):
#     value_ind_map[ratings[i]].put(i)
res = [-1]
txt = []
for rating in sorted(ratings):

    if res[0] >= rating:
        res[0] = res[0]+1
        value_ind_map[rating].append(res[0])
    else:
        res[0] =  rating
        value_ind_map[rating].append(res[0])
for rating in ratings:
    txt.append(str(value_ind_map[rating].pop()))

print(" ".join(txt))




n=int(input())
t=0
*l,=map(int,input().split())
a=l[:]
s=sorted(range(n),key=lambda x:l[x])
for i in s:
    if l[i]>t:
        t=l[i]
        a[i]=(str(t))
    else:
        t+=1
        a[i]=(str(t))
print(' '.join(a))

n =int(input())
l=list(map(int,input().split(' ')))
idxs=sorted(list(range(n)),key=lambda x :l[x])
for i in range(1,n) :
    if l[idxs[i]]<=l[idxs[i-1]] :
        l[idxs[i]]=l[idxs[i-1]]+1
print(' '.join(map(str,l)))
        


n = int(input())
a = [*list(map(int, input().split()))]
b = sorted([(i, a[i]) for i in range(n)], key = lambda x : x[1])
current = 0
for i in b:
    if current < i[1]:
        current = i[1]
        a[i[0]] = str(a[i[0]])
    else:
        current += 1
        a[i[0]] = str(current)
print(" ".join(a))


n = int(input())
a = list(map(int, input().split()))
t = 0
for x in sorted(list(range(n)), key = lambda t: a[t]):
	t = max(t + 1, a[x])
	a[x] = t
print(' '.join(map(str, a)))


n = int(input());

values = list( map(int, input().split(' ')) );
keys = sorted(list(range(n)), key = lambda a : values[a]);

last = 0;
for a in keys :
    last = max(values[a], last);
    values[a] = last;
    last += 1;

print((*values));


n = int(input())
lis = list(map(int,input().split()))
li = sorted(list(range(len(lis))), key=lambda k: lis[k])
ans=[0]*n
prev=lis[li[0]];ans[li[0]]=lis[li[0]]
for i in range(1,n):
    g=li[i]
    if prev >= lis[g]:
        prev+=1
        ans[g]=prev
    else:
        prev=lis[g]
        ans[g]=lis[g]
print(*ans)


import sys
n = int(input())
a = list(map(int, sys.stdin.read().split()))
g = sorted(list(range(n)), key=lambda x: a[x])
for i in range(1, n):
	if a[g[i]] <= a[g[i - 1]]:
		a[g[i]] = a[g[i - 1]] + 1

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



n = int(input())
x = list(map(int, input().split()))
ans = x.copy()
b = sorted(x.copy())
k = b[0] + 1
d = {b[0]: [1, b[0]]}
for i in range(1, n):
    if b[i - 1] == b[i]:
        d[b[i]].append(k)
        k += 1
    else:
        if b[i] < k:
            d[b[i]] = [1, k]
        else:
            d[b[i]] = [1, b[i]]
            k = b[i]
        k += 1
for j in range(n):
    ans[j] = d[x[j]][d[x[j]][0]]
    d[x[j]][0] += 1
print(*ans)



n=int(input())
lst=[*map(int,input().split())]
ind=sorted(range(n),key=lst.__getitem__)
elem=0
for i,x in enumerate(ind):
    elem=max(elem+1,lst[x])
    lst[x]=elem
print(*lst)