This is one more story about our old friend, the Despotic King. Once every year, it was customary for the king to give audience to the rich merchants of his country in a large hall. On that day, the merchants were ushered in to meet the king one by one and after paying their respects to the king they were seated in the auditorium.
It was the job of the minister to introduce each merchant, as he arrived, to the others in the hall. He would announce his name and his wealth. However, our quirky king demanded that in addition, he should also announce the rank of the merchant among all those in the hall (at the time of his arrival) in terms of his wealth.
For example, let us suppose that the wealth of the 6 merchants who met the king (in the order in which they arrived) is given by the sequence
78246840398978246840398978 \quad 24 \quad 68 \quad 40 \quad 39 \quad 89
Then, clearly the first merchant is the richest in the hall when he enters it (since there are no others in the hall) and so his rank is $1$. Since $24 < 78$ the rank of the second merchant when he enters the hall is $2$. The rank of the third merchant is also $2$ since $24 < 68 < 78$. The rank of the fourth merchant is $3$ since $24 < 40 < 68 < 78$, the rank of the fifth merchant is $4$ since $24 < 39 < 40 < 68 < 78$ and finally the rank of the sixth merchant is $1$ since $24 < 39 < 40 < 68 < 78 < 89$. The sequence of ranks announced by the minister would thus be:
1223411223411 \quad 2 \quad 2 \quad 3 \quad 4 \quad 1
Your task is to write a program that takes as input a sequence of distinct positive integers indicating the wealth of the merchants in the order in which they visit the king and outputs the sequence of ranks announced by the minister.

-----Input:-----
The first line contains a single integer $N$ indicating the number of merchants. The next $N$ lines (line $2,...,N+1$) describe the wealth of these $N$ merchants. Line $i+1$ contains a single positive integer indicating the wealth of the $i^{th}$ merchant to enter the hall.

-----Output:-----
Your output should consist of $N$ lines. Line $i$ should be the rank announced when the $i^{th}$ minister enters the hall.

-----Constraints:-----
- $1 \leq N \leq 45000$.
- No two merchants have the same wealth.
- You may also assume that in $30 \%$ of of the inputs $1 \leq N \leq 8000$.

-----Sample Input-----
6
78
24
68
40
39
89

-----Sample Output-----
1
2
2
3
4
1

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
arr = []
n = int(input())
for i in range(n):
	a = int(input())
	arr.append(a)
	arr.sort()
	p = arr.index(a)
	print(i - p + 1)


t = int(input())
lst = []
for m in range(t):
	n = int(input())
	lst.append(n)
l = []
for i in range(0, len(lst)):
	count = 0
	for j in range(0, i):
		if lst[i] < lst[j]:
			count = count + 1
	l.append(count + 1)
for k in l:
	print(k)


N = int(input())
M = []
for i in range(N):
	x = int(input())
	M.append(x)
	M.sort()
	print(i + 1 - M.index(x))


n = int(input())
l = []
for i in range(0, n):
	x = int(input())
	l.append(x)
	l.sort(reverse=True)
	print(l.index(x) + 1)


def ff(l, x):
	if x == max(l):
		return 1
	elif x == min(l):
		return len(l)
	else:
		ls = l
		ls.sort(reverse=True)
		return ls.index(x) + 1
n = int(input())
li = []
r = n * [1]
for i in range(0, n):
	x = int(input())
	li.append(x)
	print(ff(li, x))


def ff(l, x):
	r = 1
	for i in l:
		if i > x:
			r += 1
	return r
n = int(input())
li = []
r = n * [1]
for i in range(n):
	li.append(int(input()))
	r[i] = ff(li, li[i])
for x in r:
	print(x)


t = int(input())
l = []
for _ in range(t):
	n = int(input())
	l.append(n)
	l.sort(reverse=True)
	print(l.index(n) + 1)


l1 = []
for _ in range(int(input())):
	n = int(input())
	l1.append(n)
	l1.sort(reverse=True)
	print(l1.index(n) + 1)


from bisect import bisect_left
from sys import stdin
n = int(stdin.readline())
l = []
for i in range(n):
	t = int(stdin.readline())
	l.append(t)
	l.sort()
	print(i + 1 - bisect_left(l, t))


try:
	t = int(input())
	l = []
	for _ in range(t):
		f = int(input())
		l.append(f)
		l.sort(reverse=True)
		print(l.index(f) + 1)
except:
	pass


try:
	n = int(input())
	nums = []
	t = int(input())
	nums.append(t)
	print(1)
	for _ in range(n - 1):
		t = int(input())
		nums.append(t)
		nums.sort(reverse=True)
		rank = nums.index(t)
		print(rank + 1)
except:
	pass


from bisect import insort
try:
	x = []
	for _ in range(int(input())):
		t = int(input())
		insort(x, t)
		x.sort(reverse=True)
		print(x.index(t) + 1)
except:
	pass


n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
ans = []
ans.append(1)
for i in range(1, n):
	val = arr[i]
	for j in range(i - 1, -2, -1):
		if j == -1:
			arr[j + 1] = val
			ans.append(1)
			break
		if arr[j] < val:
			arr[j + 1] = arr[j]
		else:
			arr[j + 1] = val
			ans.append(j + 2)
			break
print(*ans, sep='\n')


n = int(input())
arr = []
val = int(input())
arr.append(val)
print(1)
for i in range(n - 1):
	val = int(input())
	arr.append(val)
	arr.sort(reverse=True)
	count = arr.index(val)
	print(count + 1)


n = int(input())
arr = []
val = int(input())
arr.append(val)
print(1)
for i in range(n - 1):
	val = int(input())
	count = 1
	for j in arr:
		if val < j:
			count += 1
	arr.append(val)
	print(count)


import sys
from bisect import insort

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
n = int(input())
Arr = []
result = []
length = 0
for i in range(n):
	t = int(input())
	insort(Arr, t)
	length += 1
	result += (length - Arr.index(t),)
for i in result:
	print(i)