贪心选最接近的,不要问我为什么-_-
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<queue>
#include<stack>
using namespace std;
#define MAXN 1010
#define MAXM 1010
#define INF 1000000000
#define MOD 1000000007
#define eps 1e-8
#define ll long long
ll f[MAXN];
int cal(ll x){
if(!x){
return 0;
}
int i;
for(i=1;f[i]<x;i++){
}
return cal(min(x-f[i-1],f[i]-x))+1;
}
int main(){
int i;
ll x;
f[0]=f[1]=1;
for(i=2;i<=91;i++){
f[i]=f[i-1]+f[i-2];
}
int tmp;
scanf("%d",&tmp);
while(tmp--){
scanf("%lld",&x);
printf("%d\n",cal(x));
}
return 0;
}
/*
*/