while a=gets() b=a.to_i 2 i=0 while b>0 b-=i+=1 end p !b?1:0end