#include <bits/stdc++.h>
using namespace std;
const int N = 107;
long long f[N];
const long long L = 1e18 + 7;
long long dp0[N], dp1[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n = 2;
  f[1] = 1;
  f[2] = 2;
  for (int i = 3; i < N; ++i) {
    f[i] = f[i - 1] + f[i - 2];
    n = i;
    if (f[i] > L) break;
  }
  int t;
  cin >> t;
  while (t--) {
    long long val;
    cin >> val;
    string s = "0";
    for (int i = n; i > 0; --i) {
      if (val >= f[i]) {
        s += "1";
        val -= f[i];
      } else
        s += "0";
    }
    s += "1";
    reverse(s.begin(), s.end());
    memset(dp0, 0, sizeof dp0);
    memset(dp1, 0, sizeof dp1);
    dp0[0] = 0;
    dp1[0] = 1;
    for (int i = 1; i < (int)s.size(); ++i) {
      if (s[i] == '0') {
        dp0[i] += dp1[i - 1];
      }
      if (s[i - 1] == '0') {
        dp0[i] += dp0[i - 2];
      }
      dp1[i] += dp1[i - 1];
      if (s[i] == '1' and s[i - 1] == '0') {
        dp1[i] += dp0[i - 2];
      }
    }
    long long res = dp1[(int)s.size() - 1];
    cout << res << "\n";
  }
  return 0;
}
