#include <bits/stdc++.h>
using namespace std;

void hhh() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

typedef long long ll;

int main() {
	hhh();
	int n ;
	cin >> n ;
	unordered_set <int > ms;
	for( int i = 0 ; i < n ; i ++) {
		int x ;
		cin >>  x ;
		ms.insert( x );
	}
	int q ;
	cin >> q ;
	while( q-- ) {
		int val ;
		cin >> val ;
		bool fl = 0 ;
		int st = 1 ;
		for( auto it = ms.begin(); it != ms.end() ; it++) {
			if( *it == val ) {
				int idx = distance (ms.begin(), it ) +1 ;
				ms.erase(it); // neu dung erase val se xao het tat ca trong val
				cout << st  <<"\n";
				fl = 1 ;
				break;
			}
			++st;
		}
		if( ! fl) cout <<"-1\n";

	}


}
