#define _USE_MATH_DEFINES #include using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); vector fib = {0, 1}; long long x = 0, y = 1; while (x + y <= 1e15) { fib.push_back(x + y); x = y; y = fib.back(); } vector a(5); for (int i = 4; i >= 0; i--) cin >> a[i]; set> st; vector vv; for (int i = 0; i < 5; i++) { vv.push_back(a[i]); st.insert(vv); } int ans = 0; for (int i = 0; i < (int) fib.size(); i++) { vector v; for (int j = i; j < i + 5 && j < (int) fib.size(); j++) { v.push_back(fib[j]); if (st.count(v)) { ans = max(ans, (int) v.size()); } } } cout << ans << '\n'; return 0; }