#include <bits/stdc++.h>
using namespace std;
short mark[5001][5001];
int clac(int a, int b) {
  if (a == 0) return 1000000;
  if (b < 5001) return (mark[a][b] == -1 ? 1000000 : mark[a][b]);
  int ans = 1000000;
  for (int i = b % a; i < 5001; i += a) {
    if (mark[a][i] != -1 && (b - i) % a == 0)
      ans = min(ans, (int)mark[a][i] + (b - i) / a);
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  queue<pair<pair<int, int>, int> > Q;
  Q.push(make_pair(pair<int, int>(1, 1), 1));
  memset(mark, -1, sizeof mark);
  mark[1][1] = 0;
  while (!Q.empty()) {
    int a = Q.front().first.first, b = Q.front().first.second,
        t = Q.front().second;
    Q.pop();
    if (a + b >= 5001) continue;
    if (mark[a][a + b] == -1) {
      mark[a + b][a] = mark[a][a + b] = t;
      Q.push(make_pair(pair<int, int>(a, a + b), t + 1));
    }
    if (mark[a + b][b] == -1) {
      mark[b][a + b] = mark[a + b][b] = t;
      Q.push(make_pair(pair<int, int>(a + b, b), t + 1));
    }
  }
  int ans = n - 1;
  for (int i = 1; i < n; ++i) {
    int a = i, b = n - i, cnt = 1;
    while (a >= 5001 && b >= 5001) {
      int ab = abs(b - a);
      a = min(a, b);
      b = ab;
      cnt++;
    }
    ans = min(ans, clac(min(a, b), max(a, b)) + cnt);
  }
  cout << ans << endl;
  return 0;
}
