#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b, int &k) {
  k = 0;
  while (b != 0) {
    k += a / b;
    a %= b;
    swap(a, b);
  }
  return a;
}
int main() {
  int n;
  int m = 1000000;
  int k = 0;
  cin >> n;
  if (n == 1) {
    cout << "0";
    return 0;
  }
  if (n == 2) {
    cout << "1";
    return 0;
  }
  for (int i = 1; i <= n / 2; ++i)
    if (gcd(i, n - i, k) == 1)
      if (k < m) m = k;
  cout << m;
}
