N = int(input()) if N == 1: print(1) exit() fibos = [a:= 1, b:=1] divedN = [a % N, b % N] while True: c = a + b fibos.append(c) divedN.append(p := c % N) if p == 0: print(len(divedN)) break a, b = b, c