#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void umax(T &a, T b) {
  if (a < b) a = b;
}
const int maxn = 200 + 4;
const int INF = 1e9 + 7;
long long f[100], dp[100][2];
long long calc(long long f, long long s) {
  long long diff = f - s;
  if (diff % 2 == 0) {
    diff = diff / 2 - 1;
  } else
    diff = diff / 2;
  return diff;
}
inline void solve(void) {
  f[1] = 1;
  f[2] = 2;
  for (int i = (3); i < (100); i++) {
    f[i] = f[i - 1] + f[i - 2];
  }
  int t;
  cin >> t;
  long long n;
  while (t--) {
    cin >> n;
    vector<int> v;
    for (int i = 88; i >= 1; i--) {
      if (n >= f[i]) {
        n -= f[i];
        v.push_back(i);
      }
    }
    v.push_back(0);
    reverse(v.begin(), v.end());
    for (int i = (1); i < (v.size()); i++) {
      if (i == 1) {
        dp[i][1] = 1;
        dp[i][0] = calc(v[i], 0);
      } else {
        dp[i][1] = dp[i - 1][0] + dp[i - 1][1];
        dp[i][0] = dp[i - 1][1] * calc(v[i], v[i - 1]) +
                   dp[i - 1][0] * calc(v[i], v[i - 1] - 1);
      }
    }
    cout << dp[v.size() - 1][1] + dp[v.size() - 1][0] << endl;
  }
  return;
}
void init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
int main(int argc, const char *argv[]) {
  init();
  solve();
  return 0;
}
