#include <bits/stdc++.h>
using namespace std;
long long f[105], g[105][2], q[105], t, n;
int main() {
  f[1] = 1;
  f[2] = 2;
  for (int i = 3; i <= 86; ++i) f[i] = f[i - 1] + f[i - 2];
  int cases;
  for (scanf("%d", &cases); cases--;) {
    scanf("%I64d", &n);
    t = 0;
    for (int i = 86; i; --i)
      if (f[i] <= n) q[++t] = i, n -= f[i];
    g[t][0] = 1;
    g[t][1] = (q[t] - 1) >> 1;
    for (int i = t - 1; i; --i) {
      g[i][0] = g[i + 1][0] + g[i + 1][1];
      int l = q[i] - q[i + 1] - 1;
      g[i][1] = (l >> 1) * g[i + 1][0] + ((l + 1) >> 1) * g[i + 1][1];
    }
    printf("%I64d\n", g[1][0] + g[1][1]);
  }
  return 0;
}
