#include <bits/stdc++.h>
using namespace std;
long long fibo[150], a[150], dp[150][2];
int mx = 1;
void precal() {
  fibo[0] = 1;
  fibo[1] = 2;
  for (int i = 2; fibo[i - 1] < (1LL << 60); i++) {
    fibo[i] = fibo[i - 1] + fibo[i - 2];
    mx = i;
  }
}
long long S(int n) { return (n - 1) / 2; }
int main() {
  precal();
  int tc;
  cin >> tc;
  while (tc--) {
    long long n;
    cin >> n;
    vector<int> index;
    int idx = mx;
    while (n) {
      while (fibo[idx] > n) idx--;
      n -= fibo[idx];
      index.push_back(idx);
    }
    int k = index.size();
    a[0] = -1;
    for (int i = 0; i < k; i++) {
      a[i + 1] = index[k - 1 - i];
    }
    memset(dp, 0, sizeof dp);
    dp[0][0] = 1;
    for (int i = 1; i <= k; i++) {
      dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
      dp[i][1] = S(a[i] - a[i - 1]) * dp[i - 1][0] +
                 S(a[i] - a[i - 1] + 1) * dp[i - 1][1];
    }
    cout << dp[k][0] + dp[k][1] << endl;
  }
}
