#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9 + 7;
int get(int x, int y) {
  if (x < 1 or y < 1) return 1e6;
  if (x == 1 and y == 1) return 0;
  if (x >= y)
    x -= y;
  else
    y -= x;
  return get(x, y) + 1;
}
void solve() {
  int n;
  cin >> n;
  int ans = n;
  for (int i = (int)1; i < (int)n + 1; i++) ans = min(ans, get(n, i));
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}
