#include <bits/stdc++.h>
using namespace std;
const int N = 105;
long long n, a[N];
long long stackk[N], top;
long long f[N][2];
int t;
int main() {
  cin >> t;
  a[1] = 1;
  a[2] = 2;
  for (int i = 3; i <= 88; i++) a[i] = a[i - 1] + a[i - 2];
  while (t--) {
    cin >> n;
    top = 0;
    for (int i = 88; i >= 1; i--) {
      if (n >= a[i]) {
        n -= a[i];
        stackk[++top] = i;
      }
    }
    reverse(stackk + 1, stackk + 1 + top);
    f[1][0] = (stackk[1] - 1) / 2;
    f[1][1] = 1;
    for (int i = 2; i <= top; i++) {
      f[i][1] = f[i - 1][0] + f[i - 1][1];
      f[i][0] = f[i - 1][0] * ((stackk[i] - stackk[i - 1]) / 2) +
                f[i - 1][1] * ((stackk[i] - stackk[i - 1] - 1) / 2);
    }
    cout << f[top][0] + f[top][1] << "\n";
  }
  return 0;
}
