#include<cstdio>
using namespace std;
int i=1,n;
inline bool dfs(int x,int y,int deep)
{
if (y==n) return 1;
if (deep>i) return 0;
if (dfs(y,x+y,deep+1)) return 1;
if (x!=y) if (dfs(x,x+y,deep+1)) return 1;
return 0;
}
int main()
{
freopen("numpair.in","r",stdin);
freopen("numpair.out","w",stdout);
scanf("%d",&n);
for (i=1;;i+=15)
if (dfs(1,1,1)) break;
while (dfs(1,1,1)) i--;
printf("%d",i+1);
fclose(stdin);
fclose(stdout);
return 0;
}