#include <bits/stdc++.h>
using namespace std;
long long fib[100], n;
int tc;
int cf = 91;
int bit[100], mem[100];
long long doit(int at) {
  if (mem[at] != -1) return mem[at];
  if (bit[at - 1] == 1) {
    mem[at] = doit(at - 1);
    return mem[at];
  }
  int now = 0, next = 0;
  for (int i = at; i > 1; i -= 2) {
    now++;
    if (bit[i - 1] == 1) {
      mem[at] = doit(i - 1);
      return mem[at];
    }
    if (bit[i - 2] == 0) {
      for (int j = i - 3; j >= 0; j--)
        if (bit[j] == 1) {
          mem[at] = now * doit(i - 2) + doit(j);
          return mem[at];
        }
      mem[at] = now * doit(i - 2) + 1;
      return mem[at];
    }
  }
  mem[at] = 1;
  return mem[at];
}
int main() {
  fib[0] = 1;
  fib[1] = 2;
  for (int i = 2; i < cf; i++) {
    fib[i] = fib[i - 1] + fib[i - 2];
  }
  scanf("%d", &tc);
  while (tc--) {
    scanf("%I64d", &n);
    int at = -1;
    for (int i = cf - 1; i >= 0; i--) {
      bit[i] = 0;
      if (n >= fib[i]) {
        n -= fib[i];
        bit[i] = 1;
        if (at == -1) at = i;
      }
    }
    long long ret = 1;
    memset(mem, -1, sizeof(mem));
    mem[0] = mem[1] = 1;
    printf("%I64d\n", doit(at));
  }
}
