#include <bits/stdc++.h>
using namespace std;
long long fib[210];
int t[210];
void solve(long long x) {
  vector<int> v;
  for (int i = 89; i >= 0; i--)
    if (x >= fib[i]) {
      v.push_back(i);
      x -= fib[i];
    }
  reverse(v.begin(), v.end());
  long long a = t[v[0]];
  long long b = 1ll;
  long long a_, b_;
  for (int i = 1; i < v.size(); i++) {
    int l = v[i] - v[i - 1] - 1;
    b_ = a + b;
    a_ = b * t[l] + a * t[l + 1];
    a = a_;
    b = b_;
  }
  cout << a + b << endl;
}
int main() {
  fib[0] = 1ll;
  fib[1] = 2ll;
  for (int i = 2; i < 200; i++) fib[i] = fib[i - 1] + fib[i - 2];
  t[0] = 0;
  t[1] = 0;
  t[2] = 1;
  for (int i = 3; i < 200; i++) t[i] = 1 + t[i - 2];
  int p;
  cin >> p;
  long long a;
  for (int i = 0; i < p; i++) {
    cin >> a;
    solve(a);
  }
  return 0;
}
