#include <bits/stdc++.h>
using namespace std;
unsigned long long F[100] = {1, 1}, k, dp[100][2];
int u[100];
int main() {
  for (int i = 2; i <= 90; i++) F[i] = F[i - 1] + F[i - 2];
  int cas = 0;
  scanf("%d", &cas);
  while (cas--) {
    scanf("%I64d", &k);
    int n = 0;
    for (int i = 90; i >= 1; i--)
      if (k >= F[i]) k -= F[i], u[n++] = i;
    reverse(u, u + n);
    dp[0][0] = 1;
    dp[0][1] = (u[0] - 1) / 2;
    int i = 0;
    for (int i = 1; i < n; i++) {
      dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
      dp[i][1] = dp[i - 1][0] * ((u[i] - u[i - 1] - 1) / 2) +
                 dp[i - 1][1] * ((u[i] - u[i - 1]) / 2);
    }
    cout << dp[n - 1][0] + dp[n - 1][1] << endl;
  }
  return 0;
}
