d=int(input());a,R=d,range for k in R(65): l,r=0,d while r-l>1: m=(l+r)//2;s,x=0,m for i in R(k):s+=x;x//=2 if s