#include "bits/stdc++.h" using namespace std; #define int long long #define REP(i,n) for(int i = 0;i < (int)(n);i++) #define RREP(i,n) for(int i = (int)n-1;i >= 0;i--) #define FOR(i,s,n) for(int i = s;i < (int)n;i++) #define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--) #define ALL(a) a.begin(),a.end() templateinline void out(T t){cout<inline void out(T t,Ts... ts){cout<inline bool CHMAX(T&a,T b){if(ainline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;} constexpr long long INF = 1e18; signed main(){ vectordp; dp.push_back(1); dp.push_back(1); int lim = 1e16; while(dp.back() < lim)dp.push_back(dp.back()+dp[dp.size()-2]); int ma = 0; vectora(5); REP(i,5)cin >> a[i]; reverse(ALL(a)); REP(i,dp.size()-4){ int t = 0; REP(j,5){ if(dp[i+j]!=a[j])break; ++t; } CHMAX(ma,t); } out(ma); }