#include <bits/stdc++.h>
#include <limits.h>
using namespace std;
#define endl '\n'
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define ll long long
#define vi vector<ll>
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main(){
fast
ll n;cin>>n;
vi a(n);
ll mn= INT_MAX;
ll index=0;
rep(i,0,n){
cin>>a[i];
if(a[i]<mn){
mn=a[i];
index=i;
}
}
ll q;
cin>>q;
while (q--)
{
ll x;
cin>>x;
cout<<index+1<<endl;
a[index]=x;
mn=x;
rep(i,0,n){
if(a[i]<mn){
mn=a[i];
index=i;
}
}
}
return 0;
}