N=int(input()) ans=float("inf") for i in range(40): memo=2**i-N tmp=0 if 2**i