#include <bits/stdc++.h>
#define fast() ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
#define ll long long int
#define ft first
#define se second
int main() {
fast();
ll N;
cin >> N;
vector<pair<ll, ll>> v(N);
for (ll i = 0; i < N; i++) {
cin >> v[i].first;
v[i].second = i + 1;
}
sort(v.begin(), v.end());
ll Q;
cin >> Q;
while (Q--) {
ll X;
cin >> X;
cout << v[0].second << endl;
v[0].first = X;
ll i = 0;
while (i + 1 < N && v[i].first > v[i + 1].first) {
swap(v[i], v[i + 1]);
i++;
}
}
return 0;
}