#include #define rep(i,n) for(int i = 0; i < (n); ++i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) using namespace std; typedef long long int ll; typedef pair P; #define yn {puts("Yes");}else{puts("No");} #define MAX_N 200005 int main() { ll a[5]; drep(i,5)cin >> a[i]; vector fib; fib.push_back(1); fib.push_back(1); while(true){ int n = fib.size(); ll x = fib[n-1] + fib[n-2]; fib.push_back(x); if(x > 1e16)break; } int n = fib.size(); int ans = 0; rep(i,1){ rep(j,n){ if(fib[j] == a[i]){ int tmp = 0; srep(k,i,5){ if(a[k] == fib[j + k - i]){ tmp++; }else{ break; } } ans = max(ans, tmp); break; } } } cout << ans << endl; return 0; }