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

public class candies_pk {
	public static void main(String[] args) {
		new candies_pk().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());
	}

	long[] c;
	int n;

	long get(int t) {
		long ans = 0;
		t++;
		while (t > 0) {
			ans += c[t];
			t = (t & (t - 1));
		}
		return ans;
	}

	void add(int t) {
		t++;
		while (t <= n) {
			c[t]++;
			t += (t - (t & (t - 1)));
		}
	}

	public void solve() throws IOException {
		n = nextInt();
		assert((1 <= n) && (n <= 100000));
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
			assert((1 <= a[i]) && (a[i] <= 1e9));
		}
		Arrays.sort(a);
		c = new long[n + 1];
		int m = nextInt();
		assert((1 <= m) && (m <= 100000));
		int[] ans = new int[m];
		for (int i = 0; i < m; i++) {
			int b = nextInt();
			assert((1 <= b) && (b <= 1e9));
			int l = 0;
			int r = n - 1;
			while (l < r) {
				int c = (l + r) / 2;
				if (a[c] - get(c) < b)
					l = c + 1;
				else
					r = c;
			}
			while ((a[l] - get(l) >= b) && (l > 0))
				l--;
			while ((l < n) && (a[l] - get(l) < b))
				l++;
			add(l);
			ans[i] = n - l;
		}
		for (int i = 0; i < m; i++)
			out.println(ans[i]);
	}

	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);
		}
	}
}