#include using namespace std; const long long INF=1000000000+5; vector flag(INF,false); vector memo(1000000000,0); long long fib(long long n){ if(n<=1){ flag[1]=true; return 1; } if(memo[n]!=0){ return memo[n]; } memo[n]=fib(n-1)+fib(n-2); flag[memo[n]]=true; return memo[n]; } int main(){ vector a(5); for(int i=0;i<5;i++){ cin >> a[i]; } int i=1; while(fib(i)<=INF){ i*=2; } if(flag[a[4]]==true && flag[a[3]]==true && flag[abs(a[3]-a[4])]==true && a[4]=0;i--){ if(a[i]!=a[i+1]+a[i+2]){ cout << 5-i-1 << endl; return 0; } } cout << 5 << endl; return 0; } if(flag[a[4]]==true){ cout << 1 << endl; return 0; } cout << 0 << endl; return 0; }