def main(): num_list = [int(input()) for _ in range(5)] num_list.reverse() if num_list[0] == 0: print(0) return if num_list[0] == 1: if num_list[1] == 1: if num_list[2] == 2: if num_list[3] == 3: if num_list[4] == 5: print(5) return print(4) return print(3) return print(2) return current = 1 before = 1 while current < num_list[0]: current, before = current+before, current if current != num_list[0]: print(0) return for idx in range(1, 5): current, before = current+before, current if current != num_list[idx]: print(idx) return print(5) if __name__ == "__main__": main()