ll@N,@A;setI{N},D{N};rep(i,N-1){ll@B;if(AB)D.insert(i);A=B;}ll@Q;rep(Q){ll@l,@r;wt((*D.lower_bound(l)>=r),(*I.lower_bound(l)>=r));}