begin integer a,b,r,i,c;while i<50do begin a:=inint;b:=0;r:=1;while a>0do begin b:=b+r*(a-a//10*10);r:=r*2;a:=a/10;end;c:=sqrt(b*8+1);if c*c=b*8+1then outchar('1')else outchar('0');i:=i+1;end;end