#include <bits/stdc++.h>
using namespace std;
int main() {
  int tests;
  long long coins;
  cin >> tests;
  for (int t = 0; t < tests; t++) {
    cin >> coins;
    long long my_count = 0;
    long long opp_count = 0;
    bool my_go = true;
    while (coins > 0) {
      if (coins > 4 && coins % 4 == 0) {
        if (my_go) {
          my_count = my_count + 1;
        } else {
          opp_count = opp_count + 1;
        }
        coins = coins - 1;
      } else if (coins % 2 == 0) {
        if (my_go) {
          my_count = my_count + (coins / 2);
        } else {
          opp_count = opp_count + (coins / 2);
        }
        coins = coins - (coins / 2);
      } else {
        if (my_go) {
          my_count = my_count + 1;
        } else {
          opp_count = opp_count + 1;
        }
        coins = coins - 1;
      }
      my_go = !my_go;
    }
    cout << my_count << endl;
  }
  return 0;
}
