# 2020/01/03 a=[int(input()) for _ in range(5)] # res=[] # for i in range(4): # if a[i]<=a[i+1]: # if (a[i]==0 # or (res.count(1)>1 and a[i]==1) # or a[i]!=1 and a[i] in res): # break # else: # res.append(a[i]) # else: # res.append(a[i]) # break # else:res.append(a[-1]) fib=[0,1] num=0 while num<=max(a): num=fib[-1]+fib[-2] fib.append(num) if a[-1]==1 and a[-2]!=1: bgn=2 cnt=1 a.pop() else: bgn=1 cnt=0 e=a.pop() flag=False for i in range(bgn,len(fib)): if flag: if fib[i]!=e:break else: if e!=fib[i]:continue flag=True cnt+=1 if not a:break e=a.pop() print(cnt)