#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int MAXN = 1e4 + 10;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double pi = acos(-1.0);
const double eps = 1e-6;
int dx[] = {0, -1, 0, 1};
int dy[] = {1, 0, -1, 0};
int test;
long long F[110], dp[110][2], G[110], N;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  F[1] = 1LL;
  F[2] = 2LL;
  for (int i = 3; i <= 89; i++) F[i] = F[i - 1] + F[i - 2];
  scanf("%d", &test);
  while (test--) {
    scanf("%I64d", &N);
    int s = 0;
    for (int i = 89; i; i--)
      if (N >= F[i]) {
        N -= F[i];
        G[++s] = i;
      }
    reverse(G + 1, G + s + 1);
    dp[0][0] = 1LL;
    dp[0][1] = 0LL;
    for (int i = 1; i <= s; i++) {
      dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
      dp[i][1] = dp[i - 1][0] * ((G[i] - G[i - 1] - 1) / 2) +
                 dp[i - 1][1] * ((G[i] - G[i - 1]) / 2);
    }
    cout << dp[s][0] + dp[s][1] << endl;
  }
  return 0;
}
