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