n=int(input()) a=b=1 if n==1: print(1) exit() if n==2: print(2) exit() for i in range(2,400): t=b b=a+b a=t if b%n==0: print(i+1) exit()