#include <bits/stdc++.h>
using namespace std;
long long f[100];
int pre[100], a[100];
long long dp1[100], dp2[100];
int main() {
  int i, j, k;
  f[1] = 1;
  f[2] = 2;
  for (i = 3; i <= 86; i++) f[i] = f[i - 1] + f[i - 2];
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    for (i = 86; i >= 1; i--)
      if (n >= f[i]) {
        a[i] = 1;
        n -= f[i];
      } else
        a[i] = 0;
    dp1[0] = 1;
    dp2[0] = 0;
    pre[1] = 0;
    a[0] = 1;
    long long ans = 1;
    for (i = 1; i <= 86; i++) {
      if (a[i - 1] == 1)
        pre[i] = i - 1;
      else
        pre[i] = pre[i - 1];
      if (a[i]) {
        j = pre[i];
        dp1[i] = dp1[j] + dp2[j];
        dp2[i] = dp1[j] * ((i - j - 1) / 2) + dp2[j] * ((i - j) / 2);
        ans = dp1[i] + dp2[i];
      }
    }
    cout << ans << endl;
  }
}
