#include <bits/stdc++.h>
using namespace std;
int T, i, m;
long long n, f[100];
vector<int> ind;
long long d[200][3];
int main() {
  scanf("%lld", &T);
  f[1] = 1;
  f[2] = 2;
  for (i = 3; f[i - 1] + f[i - 2] <= 1e18; i++)
    f[i] = f[i - 1] + f[i - 2], m = i;
  while (T--) {
    scanf("%lld", &n);
    ind.clear();
    for (i = m; i >= 1; i--)
      if (n >= f[i]) n -= f[i], ind.push_back(i);
    reverse(ind.begin(), ind.end());
    d[0][0] = 1;
    d[0][1] = (ind[0] - 1) / 2;
    for (i = 1; i < ind.size(); i++) {
      d[i][0] = d[i - 1][0] + d[i - 1][1];
      d[i][1] = d[i - 1][0] * ((ind[i] - ind[i - 1] - 1) / 2) +
                d[i - 1][1] * ((ind[i] - ind[i - 1]) / 2);
    }
    printf("%lld\n", d[ind.size() - 1][0] + d[ind.size() - 1][1]);
  }
  return 0;
}
