#include <bits/stdc++.h>
using namespace std;
long long f[101], dp1[101], dp2[101], v[101];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  f[0] = 1;
  f[1] = 1;
  for (int i = 2; i <= 87; i++) {
    f[i] = f[i - 1] + f[i - 2];
  }
  int q;
  cin >> q;
  while (q--) {
    long long x, cnt = 0;
    cin >> x;
    for (int i = 87; i > 0; i--) {
      if (x >= f[i]) {
        v[cnt++] = i;
        x -= f[i];
      }
    }
    reverse(v, v + cnt);
    dp1[0] = 1;
    dp2[0] = (v[0] - 1) / 2;
    for (int i = 1; i < cnt; i++) {
      dp1[i] = dp1[i - 1] + dp2[i - 1];
      dp2[i] = (v[i] - v[i - 1]) / 2 * dp2[i - 1] +
               (v[i] - v[i - 1] - 1) / 2 * dp1[i - 1];
    }
    cout << dp1[cnt - 1] + dp2[cnt - 1] << "\n";
  }
  return 0;
}
