#include <bits/stdc++.h>
using namespace std;
int solve(int a, int b) {
  if (a > b) swap(a, b);
  if (a == 1) return b - 1;
  if (a == 0) return 1000005;
  if (a == b && a != 1)
    return 1000005;
  else if (a == b)
    return 0;
  int r = (b / a);
  return r + solve(a, b % a);
}
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int ret = n;
  for (int i = 1; i < n; i++) {
    ret = min(ret, 1 + solve(i, n - i));
  }
  cout << ret << endl;
  return 0;
}
