a = [0] * 5 for i in range(5): a[i] = int(input()) Fib = [-1, 1, 1] while Fib[-1] <= 10 ** 15: Fib.append(Fib[-1] + Fib[-2]) cnt = 0 if a[4] in Fib: pos = Fib.index(a[4]) cnt += 1 v = [a[4]] for i in range(3, -1, -1): v.append(a[i]) #print(v, Fib[pos:pos + cnt + 1]) if v == Fib[pos:pos + cnt + 1]: cnt += 1 else: if i == 3 and a[4] == 1: pos += 1 #print(v, Fib[pos:pos + cnt + 1]) if v == Fib[pos:pos + cnt + 1]: cnt += 1 continue break print(cnt)