const fin='punctfix.in';
      fout='punctfix.out';
var i,n,x,d,nn:longint;
    f,g:text;
    a:array[0..100000] of longint;



begin
  assign(f,fin); reset(f);
  assign(g,fout); rewrite(g);
  readln(f,n);
  read(f,x);
  d:=x-1;
  inc(a[x-1-d]);
  for i:=2 to n do
    begin
      read(f,x);
      inc(a[x-i-d]);
    end;
  readln(f,n);
  for i:=1 to n do
    begin
      read(f,x);
      if (-x-d>=0) and (-x-d<100000) then
        writeln(g,a[-x-d])
      else
        writeln(g,0);
    end;
  close(f);
  close(g);
end.
