N=int(input()) M=2*N-1 T=2 K=1 while (T-1)%M: T=(2*T)%M K+=1 print(K)