#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, num, temp, i, n;
  cin >> n;
  num = n - 1;
  for (i = 2; i < n; i++) {
    temp = 1;
    a = n;
    b = i;
    while (a != 2 && b != 1) {
      if (a % b == 0) break;
      c = a % b;
      temp += a / b;
      a = b;
      b = c;
      if (temp > num) break;
      if (b == 1) {
        temp += a - 2;
        a = 2;
      }
    }
    if (a == 2 && b == 1 && temp < num) num = temp;
  }
  cout << num << endl;
  return 0;
}
