#include <bits/stdc++.h>
using namespace std;
int ans = 1e8, n;
void check(int a, int b) {
  int cnt = 0;
  while (a && b) {
    if (b < a) swap(a, b);
    if (b != a) {
      if (b % a == 0)
        cnt += b / a - 1, b = a;
      else {
        cnt += b / a;
        b = b % a;
      }
    } else {
      if (a == 1) ans = min(ans, cnt);
      return;
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) check(i, n);
  if (n == 1) ans = 0;
  cout << ans << endl;
  return 0;
}
