#include <bits/stdc++.h>
using namespace std;
int n, ans;
void dfs(int a, int b, int step) {
  if (a <= 0 || b <= 0 || step > ans) return;
  if (a == 1 && b == 1) {
    ans = min(ans, step);
    return;
  }
  dfs(a - b, b, step + 1);
  dfs(a, b - a, step + 1);
}
int main() {
  scanf("%d", &n);
  ans = n - 1;
  for (int i = 2; i <= n; i++) dfs(n, i, 0);
  printf("%d", ans);
}
