// Arup Guha
// 10/13/2013
// Solution to UCF JV Practice Problem J: Pairs of Numbers.
import java.util.*;

public class j {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();

		// Take care of this simple case.
		if (n == 1) System.out.println("0");
		else {

			// Try each value to be paired with n and evaluate it.
			int best = 1000000;
			for (int val=1; val<n; val++) {

				int score = getGCDScore(n, val);
				if (score < best)
					best = score;
			}

			// Output the best.
			System.out.println(best);
		}
	}

	// Given a tile (a b) with a > b, the shortest number of steps it takes to
	// get it down to (1 1) is equal to the number of "steps" in the GCD algorithm,
	// since each step described is a step in GCD. That's the key insight here.
	public static int getGCDScore(int a, int b) {

		int score = 0;
		while (b != 0) {

			int nextB = a%b;

			// Cut out for numbers not relatively prime.
			if (nextB == 0 && b > 1) return 1000000;

			// Since we can add one multiple of our number, our number of steps this
			// on gcd step takes is the division of the two...
			score += (a/b);
			a = b;
			b = nextB;
		}

		// We don't want to count the step where we do gcd(1,1), so subtract 1.
		return score-1;
	}
}
