#include #include #include #include #include #include #include #include #include #include #include #include #define INF 1000000 #define eps 1e-8 #define MAXN (100000+10) #define MAXM (100000+10) #define Ri(a) scanf("%d", &a) #define Rl(a) scanf("%lld", &a) #define Rf(a) scanf("%lf", &a) #define Rs(a) scanf("%s", a) #define Pi(a) printf("%d\n", (a)) #define Pf(a) printf("%.2lf\n", (a)) #define Pl(a) printf("%lld\n", (a)) #define Ps(a) printf("%s\n", (a)) #define W(a) while((a)--) #define CLR(a, b) memset(a, (b), sizeof(a)) #define MOD 1000000007 #define LL long long #define lson o<<1, l, mid #define rson o<<1|1, mid+1, r #define ll o<<1 #define rr o<<1|1 #define PI acos(-1.0) #pragma comment(linker, "/STACK:102400000,102400000") #define fi first #define se second using namespace std; typedef pair pii; LL f[10000]; void get() { f[1] = 1LL; f[2] = 2LL; for(int i = 3; i <= 1000; i++) f[i] = f[i-1] + f[i-2]; } int main() { get(); int t; Ri(t); W(t) { LL n; scanf("%I64d", &n); LL sum = 0LL; int i = 1; for(; i <= 1000; i++) { sum += f[i]; if(sum >= n) break; } if(sum > n) i--; Pi(i); } return 0; }