#include <bits/stdc++.h>
using namespace std;
int N;
int ans = 1e9;
void dfs(int a, int b, int step) {
  if (a < 1 || b < 1) return;
  if (a == 1 && b == 1) {
    ans = min(ans, step);
  }
  if (a - b >= 1) dfs(a - b, b, step + 1);
  if (b - a >= 1) dfs(a, b - a, step + 1);
}
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    dfs(i, N, 0);
  }
  cout << ans << endl;
  return 0;
}
