#include <bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long int
#define loop(n) for (int i = 0; i < n; i++)
void solve()
{
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
int q;
cin >> q;
while (q--)
{
int x;
cin >> x;
int minPos = 1;
for (int i = 0; i < n - 1; i++)
{
if (arr[i + 1] < arr[i])
{
minPos = i + 1;
}
}
arr[minPos] = x;
cout << minPos + 1 << endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
return 0;
}