#include #include using namespace std; int main(void) { vector a(5); for (int i = 4; i >= 0; --i) cin >> a[i]; vector fib(100, -1); fib[0] = 1, fib[1] = 1; int cnt = 2; while (1) { fib[cnt] = fib[cnt - 1] + fib[cnt - 2]; if (fib[cnt] > 1e15) break; ++cnt; } cnt = 0; int max_cnt = 0; for (int i = 0; i < 5; ++i) { for (int j = 0; j < fib.size(); ++j) { cnt = 0; for (int k = 0; k <= i; ++k) { if (a[k] == fib[k + j]) ++cnt; else break; } max_cnt = max(cnt, max_cnt); } } cout << max_cnt << endl; return 0; }