#include using namespace std; long long memo[10000]; long long fib(int n) { if (memo[n] != 0) return memo[n]; if (n == 0 || n == 1) return memo[n] = 1; return memo[n] = fib(n - 1) + fib(n - 2); } int main(void) { vector a(5); for (int i = 0; i < 5; i++) { cin >> a[4 - i]; } fib(100); int cnt = 0; for (int i = 0; i < 100; i++) { if (cnt != 0 && memo[i] != a[cnt]) { break; } if (a[cnt] == memo[i]) cnt++; } cout << cnt << endl; return 0; }