import java.io.*;
import java.util.*;

public class candies_pk_slow {
	public static void main(String[] args) {
		new candies_pk_slow().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public void solve() throws IOException {
		int n = nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		int m = nextInt();
		for (int i = 0; i < m; i++) {
			int ans = 0;
			int b = nextInt();
			for (int j = 0; j < n; j++)
				if (a[j] >= b) {
					a[j]--;
					ans++;
				}
			out.println(ans);
		}
	}

	public void run() {
		try {
			br = new BufferedReader(new FileReader("candies.in"));
			out = new PrintWriter("candies.out");
			//br = new BufferedReader(new InputStreamReader(System.in));
			//out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}