atevtg3
# a = int(input())
# st = []
# wg = 0 # w(hat i lookin)g
# x = list(map(int,input().split()))
# for i in range(a):
# if len(st)==0:
# st.append([x[i],i])
# print('0',end='')
# continue
# # print('\n asdfasdf',st[-1][0], st[-1][1], len(st), x[i])
# while len(st)!=0 and x[i] >= st[-1][0]:
# st.pop()
# #print(st)
#
# if len(st)!=0:
# # print('asdfasdf2',st[-1][0],st[-1][1],i,x[i])
# print('',st[-1][1]+1,end='')
# else:
# print(' 0',end='')
# st.append([x[i],i])
a = int(input())
b = list(map(int,input().split()))
c = int(input())
d = list(map(int,input().split()))
import sys
sys.setrecursionlimit(354796868)
def bs(target,sp,ep):
global b
cPos = sp+((ep-sp)//2)
if target == b[cPos]:
return cPos + 1
elif target < b[cPos]:
bs(target,sp,cPos)
else:
bs(target,cPos,ep)
if sp==ep:
return -1
for i in range(c):
print(bs(d[i],0,len(b)-1),end=' ')1회 조회




