var     a:array[1..10000] of longint;
        i,j,n,d,m,count:integer;
        b,k:longint;
        o,q:text;

begin
assign(o,'punctfix.in');
reset(o);
readln(o,n);
assign(q,'punctfix.out');
rewrite(q);


        for i:=1 to n do
         read(o,a[i]);

        d:=a[n]-a[1];
        readln(o,k);
        for i:=1  to k do
        begin
        read(o,b);
                if (b<=d) and (b>=-1*d) then
                begin
                        for j:=1 to n do
                        if a[j]+b=j then
                        begin
				count:=1;
                                m:=j+1;
                                while a[m]-a[j]=m-j do
                                begin
                                         m:=m+1;
                                         count:=count+1;
                                end;
                                break;
                        end;
                        writeln(q,count);
                        count:=0;
                end else writeln(q,'0');
        end;
        close(o);
        close(q);

end.
