#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  bool flag = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') flag = 0;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return flag ? x : -x;
}
int n;
int main() {
  n = read();
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int ans = n - 1;
  for (int i = 2; i <= n / 2; i++) {
    int x = i, y = n - i;
    if (x == y) continue;
    if (x == y || (x % 2 == 0 && y % 2 == 0)) continue;
    int aa = 1;
    bool f = 0;
    while (x != 1 && y != 1) {
      int t = y;
      y = y % x;
      if (y == 0) {
        f = 1;
        break;
      }
      aa += (t / x);
      swap(x, y);
    }
    if (f == 1) continue;
    aa += (y - 1);
    ans = min(aa, ans);
  }
  cout << ans << endl;
  return 0;
}
