human
An array of integers p_{1},p_{2}, …,p_{n} is called a permutation if it contains each number from 1 to n exactly once. For example, the following arrays are permutations: [3,1,2], [1], [1,2,3,4,5] and [4,3,1,2]. The following arrays are not permutations: [2], [1,1], [2,3,4].

There is a hidden permutation of length n.

For each index i, you are given s_{i}, which equals to the sum of all p_{j} such that j < i and p_{j} < p_{i}. In other words, s_i is the sum of elements before the i-th element that are smaller than the i-th element.

Your task is to restore the permutation.

Input

The first line contains a single integer n (1 ≤ n ≤ 2 ⋅ 10^{5}) — the size of the permutation.

The second line contains n integers s_{1}, s_{2}, …, s_{n} (0 ≤ s_{i} ≤ (n(n-1))/(2)).

It is guaranteed that the array s corresponds to a valid permutation of length n.

Output

Print n integers p_{1}, p_{2}, …, p_{n} — the elements of the restored permutation. We can show that the answer is always unique.

Examples

Input

3
0 0 0

Output

3 2 1

Input

2
0 1

Output

1 2

Input

5
0 1 1 1 10

Output

1 4 3 2 5

Note

In the first example for each i there is no index j satisfying both conditions, hence s_i are always 0.

In the second example for i = 2 it happens that j = 1 satisfies the conditions, so s_2 = p_1.

In the third example for i = 2, 3, 4 only j = 1 satisfies the conditions, so s_2 = s_3 = s_4 = 1. For i = 5 all j = 1, 2, 3, 4 are possible, so s_5 = p_1 + p_2 + p_3 + p_4 = 10.
Using python can you solve the prior task?

Write me a Python code to print n integers p_{1}, p_{2}, …, p_{n} — the elements of the restored permutation?
assistant
#Here is Python code to print n integers p_{1}, p_{2}, …, p_{n} — the elements of the restored permutation.

def bsearch(k,tree,n):

	low = 1
	high = n
	cnt = 0
	while low <= high:
		mid = (low+high)/2
		tmp1 = sum(tree,mid-1)
		tmp2 = sum(tree,mid)
		s   = mid*(mid-1)/2
		if k+tmp2 == s and tmp1 == tmp2:
			break
		elif k+tmp1 <s:
			high = mid-1
		else:
			low  = mid +1
	return mid

def lowbit(x):
	return x&-x
def add(t,i,v):
	while i<len(t):
		t[i]+=v
		i += lowbit(i)

def sum(t,i):
	ans = 0
	while i>0:
		ans += t[i]
		i -= lowbit(i)
	return ans
def main():
	n 	= int(input())
	arr = readnumbers()
	tree = [0]*(n+1)
	ans = []
	dic = [0]*(n+1)
	for i in range(n-1):
		v = bsearch(arr[n-1-i],tree,n)
		dic[v] = 1
		ans.append(v)
		add(tree,v,v)
	for k,v in enumerate(dic[1:]):
		if v == 0:
			ans.append(k+1)
			break
	print " ".join(map(str,ans[::-1]))

######## Python 2 and 3 footer by Pajenegod and c1729
 
# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.
 
# So on cf, use PyPy2 for best string performance.
 
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange
 
import os, sys
from io import IOBase, BytesIO
 
BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0
 
    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None
 
    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s
 
    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()
 
    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
       ...