var n,i,k,j,v,q:longint;
a,b:array[1..10000] of longint;
f,g:text;
begin
v:=0;
assign(g,'punctifx.out');
rewrite(g);
assign(f,'punctfix.in');
reset(f);
readln(f,n);
for i:=1 to n do read(f,a[i]);
readln(f,k);

//for i:=1 to k do begin read(f,b[i]);
for q:=1 to k do begin
read(f,j);
for i:=1 to n do begin
b[i]:=a[i]+j;
if b[i]=i then  v:=v+1;
end;
writeln(g,v);
v:=0;
end;
close(f);
close(g);
end.
