#include <bits/stdc++.h>
using namespace std;
const long long MaxN = 1000000000000000000;
long long n, dp2, dp1, dp;
int main() {
  cin >> n;
  dp1 = 1;
  dp = 2;
  long long i;
  for (i = 2; dp < n; ++i) {
    long long prev = dp;
    dp = dp + dp1 + 1;
    dp1 = prev;
  }
  cout << i - 1 << '\n';
  return 0;
}
