#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b, int& c) {
  if (!b) return a;
  if (b <= a) c += a / b;
  return gcd(b, a % b, c);
}
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    int best = ~(1 << 31);
    for (int i = 1; i <= n; ++i) {
      int counter = 0;
      int ret = gcd(n, i, counter);
      if (ret != 1) continue;
      best = min(best, counter - 1);
    }
    printf("%d\n", best);
  }
  return 0;
}
