module c;real d;initial while($fscanf(1<<31,"%b",d))$write(~|(($sqrt(8*d+1)-1)/2%1));endmodule