#include #include #include #define N 1200 #define ll long long using namespace std; ll n, m, a[N]; void init() { int i, j; a[0] = 1; a[1] = 2; for (i = 2; i < N; i++) a[i] = a[i-1]+a[i-2]; } int main() { int i, j, k, T; ll t; init(); cin >> T; while(T--) { cin >> n; if (n == 1 || n == 2) { cout << 1 << endl; continue; } for (i = 1; i < N; i++) { t = 2*a[i] + a[i-1] - 2; if (t > n) break; else if ( t == n) { i++; break; } } cout << i << endl; } return 0; }