program cojs1789_1;
var
i,j,k,n,a,b,ans:longint;
function jisuan(x,y:longint):longint;
var
t,i,j:longint;
begin
t:=0;
while (x<>1)or(y<>1) do
begin
if (x=y) then exit(maxlongint);
if (x>y)and(x mod y<>0) then begin
inc(t,x div y); x:=x mod y;
end;
if (x>y)and(x mod y=0) then begin x:=x-y; inc(t); end;
if (y>x)and(y mod x<>0) then begin inc(t,y div x); y:=y mod x; end;
if (y>x)and(y mod x=0) then begin y:=y-x; inc(t); end;
end;
exit(t);
end;
begin
assign(input,'numpair.in');
assign(output,'numpair.out');
reset(input);
rewrite(output);
readln(n);
ans:=maxlongint;
for i:=n div 3 to n div 2 do
begin
k:=jisuan(n,i);
if ans>k then
ans:=k;
end;
writeln(ans);
close(input);
close(output);
end.