#include using namespace std; typedef long long ll; int main() { ll a[5]; for (int i = 0; i < 5; i++) { cin >> a[i]; } ll F[80]{}; F[0] = 0; F[1] = 1; for (int i = 2; i < 80; i++) { F[i] = F[i - 1] + F[i - 2]; } int ans = 0; for (int i = 0; i < 74; i++) { int t = 0; for (int j = 4; j >= 0; j--) { if (a[j] != F[i + 4- j]) break; t++; } ans = max(ans, t); } cout << ans << "\n"; return 0; }