N = int(input()) a, b = 1 % N, 1 % N c = 1 while a: c += 1 a, b = b % N, (a + b) % N print(c)