#include <bits/stdc++.h>
using namespace std;
long long fib[100];
void init() {
  fib[0] = 1, fib[1] = 2;
  for (int i = 2; i <= 85; i++) fib[i] = fib[i - 1] + fib[i - 2];
}
int w[100];
int dp[100][2];
void solve(long long x) {
  memset(w, 0, sizeof(w));
  memset(dp, 0, sizeof(dp));
  int num = 0;
  for (int i = 85; i >= 0; i--) {
    if (x >= fib[i]) {
      x -= fib[i];
      w[num++] = i;
    }
  }
  num--;
  dp[0][1] = 1;
  dp[0][0] = w[num] >> 1;
  int i = 0;
  while (num > 0) {
    num--;
    dp[i + 1][0] = dp[i][0] * ((w[num] - w[num + 1]) >> 1) +
                   dp[i][1] * ((w[num] - w[num + 1] - 1) >> 1);
    dp[i + 1][1] = dp[i][0] + dp[i][1];
    i++;
  }
  cout << dp[i][0] + dp[i][1] << endl;
}
int main() {
  ios::sync_with_stdio(false);
  init();
  int t;
  cin >> t;
  while (t--) {
    long long x;
    cin >> x;
    solve(x);
  }
  return 0;
}
