#include <cstdio>
#define nmax 10005
using namespace std;
long st, dr, m, x, inc, sf, i, v[nmax], n, k;

void stanga()
{
	st=1;	dr=n;
	while (st<=dr)
	{
		m=(st+dr)/2;
		if (v[m]<=x)
			dr=m-1;
		else
			st=m+1;
	}
	inc=st;
}

void dreapta()
{
	st=inc;	dr=n;
	while (st<=dr)
	{
		m=(st+dr)/2;
		if (v[m]>=x)
			st=m+1;
		else
			dr=m-1;
	}
	sf=dr;
}

int main()
{
	freopen("punctfix.in","r",stdin);
	freopen("punctfix.out","w",stdout);
	scanf("%ld",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%ld",&x);
		v[i]=i-x;
	}
	scanf("%ld",&k);
	for (i=1;i<=k;i++)
	{
		scanf("%ld",&x);
		stanga();		dreapta();
		printf("%ld\n",sf-inc+1);
	}
	return 0;
}
