#include <bits/stdc++.h>
using namespace std;
int main() {
//Number of terms in the series having 0, 1.
vector< long long > forward(2, 0), backward(2, 0);
forward[1] = backward[1] = 1;
long long MAX = 1e9;
//Positive elements.
while(forward.back() <= MAX){
auto n = forward.size();
auto next_element = forward[n-1] + forward[n-2];
forward.push_back(next_element);
}
int count_elements = forward.size();
//On the other side.
while(abs(backward.back()) <= MAX){
auto n = backward.size();
auto next_element = backward[n-2] - backward[n-1];
backward.push_back(next_element);
}
count_elements += backward.size() - 2;
cout<<count_elements<<endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCS8vTnVtYmVyIG9mIHRlcm1zIGluIHRoZSBzZXJpZXMgaGF2aW5nIDAsIDEuCgl2ZWN0b3I8IGxvbmcgbG9uZyA+IGZvcndhcmQoMiwgMCksIGJhY2t3YXJkKDIsIDApOwoJZm9yd2FyZFsxXSA9IGJhY2t3YXJkWzFdID0gMTsKCWxvbmcgbG9uZyBNQVggPSAxZTk7CgkvL1Bvc2l0aXZlIGVsZW1lbnRzLgoJd2hpbGUoZm9yd2FyZC5iYWNrKCkgPD0gTUFYKXsKCQlhdXRvIG4gPSBmb3J3YXJkLnNpemUoKTsKCQlhdXRvIG5leHRfZWxlbWVudCA9IGZvcndhcmRbbi0xXSArIGZvcndhcmRbbi0yXTsKCQlmb3J3YXJkLnB1c2hfYmFjayhuZXh0X2VsZW1lbnQpOwoJfQoJaW50IGNvdW50X2VsZW1lbnRzID0gZm9yd2FyZC5zaXplKCk7CgkvL09uIHRoZSBvdGhlciBzaWRlLgoJd2hpbGUoYWJzKGJhY2t3YXJkLmJhY2soKSkgPD0gTUFYKXsKCQlhdXRvIG4gPSBiYWNrd2FyZC5zaXplKCk7CgkJYXV0byBuZXh0X2VsZW1lbnQgPSBiYWNrd2FyZFtuLTJdIC0gYmFja3dhcmRbbi0xXTsKCQliYWNrd2FyZC5wdXNoX2JhY2sobmV4dF9lbGVtZW50KTsKCX0KCWNvdW50X2VsZW1lbnRzICs9IGJhY2t3YXJkLnNpemUoKSAtIDI7Cgljb3V0PDxjb3VudF9lbGVtZW50czw8ZW5kbDsKCXJldHVybiAwOwp9