def solve_queries(N, A, Q, queries):
# Initialize the minimum value and its index
min_value = float('inf')
min_index = -1
# Find the initial minimum value and its index
for i in range(N):
if A[i] < min_value:
min_value = A[i]
min_index = i
# Process each query
for X in queries:
# Print the position of the original minimum value
print(min_index + 1) # Adding 1 to convert from 0-based index to 1-based index
# Update the array with the new value
A[min_index] = X
# Find the new minimum value and its index
min_value = float('inf')
for i in range(N):
if A[i] < min_value:
min_value = A[i]
min_index = i
# Example usage
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
queries = [int(input()) for _ in range(Q)]
solve_queries(N, A, Q, queries)