#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int func(int a, int b) {
  if (a == 1 and b >= 1) return (b - a);
  if (a == b or b % a == 0 or a <= 0 or b <= 0) return INT_MAX;
  int ret = func(b % a, a);
  if (ret != INT_MAX) ret += b / a;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int ans = INT_MAX;
  for (int i = n >> 1; i > 0; i--) {
    ans = min(ans, func(i, n - i));
  }
  cout << ans + 1 << endl;
  return 0;
}
