#include <bits/stdc++.h>
using namespace std;
int minn = 2000000000;
void dfs(int x, int y, int r) {
  if (r > minn) return;
  if (x == 1 && y == 1) {
    minn = min(minn, r);
    return;
  }
  if (x < 1 || y < 1) return;
  if (x > y)
    dfs(x - y, y, r + 1);
  else if (y > x)
    dfs(x, y - x, r + 1);
}
int main() {
  int n;
  cin >> n;
  if (n <= 1) {
    cout << 0;
    return 0;
  }
  if (n == 2) {
    cout << 1;
    return 0;
  }
  for (int i = 2; i < n; i++) dfs(i, n, 0);
  cout << minn;
  return 0;
}
