N=int(input()) count=0 A=[0,1,4,10,21,42,84,169,340,682,1365,2730,5460,10921,21844,43690,87381,174762,349524,699049,1398100,2796202,5592405] ss=25 count=A[-1] for i in range(len(A)): if A[i]>=N: ss=i-1+3 count=A[i-1] break for j in range(1<