
var f,g:text;
a,v,c:array[1..100] of longint;
i,j,n,m,k,l,d,s:longint;
begin assign(f,'punctfix.in');reset(f);
read(f,n);
for i:=1 to n do read(f,a[i]);
read(f,k);
for i:=1 to k do read(f,v[i]);

for i:=1 to k do
for j:=1 to n do if a[j]+v[i]=j then inc(c[i]);
assign(g,'punctfix.out');rewrite(g);
for i:=1 to k do writeln(g,c[i]);
close(f);close(g)
end.
