import sys input = sys.stdin.readline F=[1,1,1] for i in range(5000): F.append(F[-1]+F[-2]) N=int(input()) A=[0]*5000 for i in range(5000): if F[i]%N==0: A[i]=1 for i in range(1,5000): if A[i]==1: for j in range(i,5000,i): if A[j]==1: pass else: break else: print(i) exit()