#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int n, ans = 1 << 30;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a = i, b = n, t = 0;
    while ((a > 1 || b > 1) && a != 0 && b != 0) {
      if (a > b)
        a -= b;
      else
        b -= a;
      ++t;
    }
    if (a == 1 && b == 1) ans = min(ans, t);
  }
  cout << (n == 1 ? 0 : ans);
  return 0;
}
