#include <iostream>
using namespace std;

int main() {
    int n;
    while (cin >> n){
        if (n <= 3) {
            cout << 0<<endl;
            continue;
        }
        int fst = 1, scd = 2, ct = 2;
        int cur = fst + scd;
        while (cur <= n)
        {
            ++ct;
            fst = scd;
            scd = cur;
            cur = fst + scd;
        }
        cout << n - ct<<endl;
    }
}
10%,求找错