F=[0,1] for i in range(2,400): F.append(F[-1]+F[-2]) N=int(input()) ans=[i for i in range(len(F)) if F[i]%N==0][1] print(ans)