#include <bits/stdc++.h>
using namespace std;
const int N = 105;
long long t, n, f[N], dp1[N], dp2[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  f[1] = 1;
  f[2] = 2;
  for (int i = 3; i <= 91; i++) {
    f[i] = f[i - 1] + f[i - 2];
  }
  cin >> t;
  while (t--) {
    cin >> n;
    int cur = 91, q[100], sz = 0;
    q[0] = 0;
    while (n) {
      if (n >= f[cur]) {
        q[++sz] = cur;
        n -= f[cur];
      }
      cur--;
    }
    reverse(q + 1, q + sz + 1);
    dp1[0] = 1, dp2[0] = 0;
    for (int i = 1; i <= sz; i++) {
      dp1[i] = dp1[i - 1] + dp2[i - 1];
      dp2[i] = dp1[i - 1] * ((q[i] - q[i - 1] - 1) / 2) +
               dp2[i - 1] * ((q[i] - q[i - 1]) / 2);
    }
    cout << dp1[sz] + dp2[sz] << "\n";
  }
}
