#include <bits/stdc++.h>
using namespace std;
void start() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
long long ans = INT_MAX;
void solve(long long a, long long b, long long k, long long steps) {
  if (a == 1 && b == 1) {
    ans = min(ans, steps);
    return;
  }
  if (a - b > 0) solve(a - b, b, k, steps + 1);
  if (b - a > 0) solve(a, b - a, k, steps + 1);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  start();
  long long n;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    solve(i, n - i, n, 1);
  }
  if (ans == INT_MAX)
    cout << "0"
         << "\n";
  else
    cout << ans << "\n";
}
