while a=gets() b,i=a.to_i,1 while b>0 b-=i i+=1 end puts b==0 ? 0:1 end