#include <bits/stdc++.h>
using namespace std;
void aasani() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long solve(long long n) {
  if (n < 5) return max(1ll, n - 1);
  if ((n % 2 == 1) || (n % 4 == 0)) return (n - solve(n - 1));
  return (n - solve(n / 2));
}
int main() {
  aasani();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    cout << solve(n) << endl;
    ;
  }
}
