#include <bits/stdc++.h>
using namespace std;
long long f[100];
int s[100];
long long dp[100][2];
int main() {
  f[0] = f[1] = 1;
  for (int i = 2; i < 100; i++) {
    f[i] = f[i - 1] + f[i - 2];
  }
  int cas;
  cin >> cas;
  while (cas--) {
    long long n;
    cin >> n;
    int cnt = 0;
    for (int i = 90; i >= 1; i--) {
      if (n >= f[i]) {
        n -= f[i];
        s[++cnt] = i;
      }
    }
    reverse(s + 1, s + cnt + 1);
    dp[0][0] = 1;
    dp[0][1] = 0;
    for (int i = 1; i <= cnt; i++) {
      dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
      dp[i][1] = dp[i - 1][0] * ((s[i] - s[i - 1] - 1) / 2) +
                 dp[i - 1][1] * ((s[i] - s[i - 1]) / 2);
    }
    cout << dp[cnt][0] + dp[cnt][1] << endl;
  }
  return 0;
}
