#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sp " "
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
void messi()
{
ll n;
cin >> n;
vector<ll> v(n);
for (ll &x : v)
cin >> x;
ll q;
cin >> q;
while (q--)
{
ll a;
cin >> a;
ll mn = INT_MAX;
ll index = 0;
for (ll i = 0; i < n; i++)
{
if (v[i] < mn)
{
mn = v[i];
index = i;
}
}
v[index] = a;
cout << index + 1 << endl;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
ll tc = 1; // cin>>tc;
while (tc--)
{
messi();
}
return 0;
}