#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(const T a) {
  return a > 0 ? a : -a;
}
const double PI = 2.0 * acos(1.0);
int n;
int m;
int k = 0;
int gcd(int a, int b) {
  if (b == 0) {
    k--;
    return a;
  }
  k += a / b;
  return gcd(b, a % b);
}
int main() {
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int ans = n + 1;
  for (int i = 1; i < n; i++) {
    k = 0;
    if (gcd(i, n) == 1) ans = min(ans, k);
  }
  cout << ans << endl;
  return 0;
}
