#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double PI = acos((long double)-1);
const int INF = 1e7;
int go(int a, int b) {
  if (a < 1 || b < 1) {
    return INF;
  }
  if (a == 1 && b == 1) return 0;
  if (a > b) {
    return (1 + go(a - b, b));
  } else {
    return (1 + go(a, b - a));
  }
}
void solve() {
  int n;
  cin >> n;
  int ans = n - 1;
  for (int i = 2; i <= n - 1; ++i) {
    ans = min(ans, go(i, n));
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
