#include <bits/stdc++.h>   using namespace std;   int cnt_occur(string s, string t) {     int cnt = 0;     for (int i = 0; i < s.size(); ++i) {       if (s.substr(i, 3) == t) cnt++;     }     return cnt;   }   long max(int a, int b) { return a >= b ? a : b; }   void swap(int &a, int &b) {     int temp = a;     a = b;     b = temp;   }   int power(int x, unsigned int y) {     int temp;     if (y == 0) return 1;     temp = power(x, y / 2);     if (y % 2 == 0)       return temp * temp;     else       return x * temp * temp;   }   int gcd(int a, int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   void soE(int n, bool f[]) {     for (int i = 0; i < n; ++i) f[i] = true;     f[0] = f[1] = false;     for (int p = 2; p * p <= n; p++) {       if (f[p] == true) {         for (int i = p * p; i <= n; i += p) f[i] = false;       }     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     int t;     cin >> t;     ;     while (t--) {       long long a;       cin >> a;       long long cnt = 0;       long long temp = a;       while (a) {         if (temp % 2 == 0) {           if (a % 2 == 0) {             if ((a / 2) % 2 != 0 or a == 4) {               cnt += a / 2;               if (a == 4) {                 a = a / 2;               } else                 a = a / 2 - 1;             } else {               cnt += 1;               a -= 2;             }           }         } else {           if (a == 5) {             cnt += 2;             break;           }           cnt += 1;           a = a - 1;           if (a == 0) break;           if ((a / 2) % 2 == 0)             a -= 1;           else             a = a / 2;         }       }       cout << cnt << endl;     }     return 0;   }   