#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
string int_to_string(int x) {
  stringstream ss;
  ss << x;
  string ni = ss.str();
  return ni;
}
int string_to_int(string x) {
  int n;
  stringstream s(x);
  s >> n;
  return n;
}
int64_t power_mod(long long a, long long b, long long mo) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans % mo * a % mo) % mo;
    }
    a = (a % mo * a % mo) % mo;
    b /= 2;
  }
  return ans;
}
int64_t POW(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = ans * a;
    }
    a = a * a;
    b /= 2;
  }
  return ans;
}
vector<int64_t> INVERSE(int64_t nn, int64_t mo) {
  vector<int64_t> inv(nn + 1);
  vector<int64_t> mul(nn + 1);
  inv[0] = 1;
  inv[1] = 1;
  for (long long i = 2; i <= nn; ++i) {
    inv[i] = (mo - (mo / i) * inv[mo % i] % mo) % mo;
  }
  mul[0] = 1;
  for (int i = 1; i <= nn; ++i) {
    mul[i] = (mul[i - 1] * inv[i]) % mo;
  }
  return mul;
}
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
bool isprime(long long a) {
  for (long long i = 2; i * i <= a; ++i) {
    if (a % i == 0) {
      return 0;
    }
  }
  return 1;
}
vector<int64_t> prime;
vector<int64_t> prime_mul(7);
vector<int64_t> ton_mul(7);
int64_t val;
int p;
map<pair<int, int>, int> m;
int64_t get_val(int64_t x, int a) {
  return (x / prime_mul[a]) * ton_mul[a] + get_val(x % prime_mul[a], a);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int ans = 1e9 + 7;
  for (int i = 1; i <= n; ++i) {
    int a = i;
    int b = n;
    int cnt = 0;
    while (a != 1 || b != 1) {
      if (a < 1 || b < 1) {
        cnt = -1;
        break;
      }
      if (a > b)
        a -= b;
      else
        b -= a;
      cnt++;
    }
    if (cnt != -1) ans = min(ans, cnt);
  }
  cout << ((ans == 1e9 + 7) ? 0 : ans);
}
