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