#include <bits/stdc++.h>
using namespace std;
int ucln(int a, int b, int &d) {
  int r;
  d = 0;
  while (b) {
    r = a % b;
    d += a / b;
    a = b;
    b = r;
  }
  d--;
  return a;
}
int main() {
  int n, i, kq = n - 1, j;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    if (ucln(n, i, j) == 1 && j < kq) kq = j;
  }
  printf("%d", kq);
}
