D=int(input()) L=D//2 R=D while L!=R: now=(L+R)//2 count=0 while count0: count+=now now//=2 if count>=D: R=(L+R)//2 else: L=(L+R)//2+1 while L