#include <bits/stdc++.h>
using namespace std;
const int MAXN = (100);
const int64_t inf = (int64_t)1e18 + 42;
int64_t n;
void read() { cin >> n; }
int64_t psum[MAXN], sz, fib[MAXN];
int64_t dp[MAXN][2];
void solve() {
  vector<int> li;
  for (int p = sz - 1; p >= 1; p--)
    if (n >= fib[p]) n -= fib[p], li.push_back(p);
  li.push_back(0);
  memset(dp, 0, sizeof(dp));
  dp[li.size() - 1][0] = 1;
  for (int i = li.size() - 2; i >= 0; i--) {
    dp[i][0] = dp[i + 1][1] + dp[i + 1][0];
    dp[i][1] = dp[i + 1][0] * (((li[i] - li[i + 1] - 1) >> 1)) +
               dp[i + 1][1] * (((li[i] - li[i + 1]) >> 1));
  }
  cout << dp[0][0] + dp[0][1] << '\n';
}
void precompute() {
  fib[1] = 1;
  psum[1] = 1;
  fib[2] = 2;
  psum[2] = 3;
  for (int i = 3;; i++) {
    fib[i] = fib[i - 1] + fib[i - 2];
    if (fib[i] >= inf) {
      sz = i;
      break;
    }
    psum[i] = (psum[i - 1] >= inf) ? inf : (psum[i - 1] + fib[i]);
    if (psum[i] >= inf) psum[i] = inf;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T;
  cin >> T;
  precompute();
  while (T--) {
    read();
    solve();
  }
  return 0;
}
