Lately, Mr. Chanek frequently plays the game Arena of Greed. As the name implies, the game's goal is to find the greediest of them all, who will then be crowned king of Compfestnesia.

The game is played by two people taking turns, where Mr. Chanek takes the first turn. Initially, there is a treasure chest containing N gold coins. The game ends if there are no more gold coins in the chest. In each turn, the players can make one of the following moves:

  * Take one gold coin from the chest. 
  * Take half of the gold coins on the chest. This move is only available if the number of coins in the chest is even. 



Both players will try to maximize the number of coins they have. Mr. Chanek asks your help to find the maximum number of coins he can get at the end of the game if both he and the opponent plays optimally.

Input

The first line contains a single integer T (1 ≤ T ≤ 10^5) denotes the number of test cases.

The next T lines each contain a single integer N (1 ≤ N ≤ 10^{18}).

Output

T lines, each line is the answer requested by Mr. Chanek.

Example

Input


2
5
6


Output


2
4

Note

For the first case, the game is as follows: 

  1. Mr. Chanek takes one coin. 
  2. The opponent takes two coins. 
  3. Mr. Chanek takes one coin. 
  4. The opponent takes one coin. 



For the second case, the game is as follows: 

  1. Mr. Chanek takes three coins. 
  2. The opponent takes one coin. 
  3. Mr. Chanek takes one coin. 
  4. The opponent takes one coin. 
#include <bits/stdc++.h>
using namespace std;
const bool TEST = false;
const long double PI = 3.1415926535897932384626433832795;
const int inf = 2147483647;
const long long infll = 9223372036854775807;
const int mod = 1000000007;
long long max(int a, long long b) { return max((long long)a, b); }
long long min(int a, long long b) { return min((long long)a, b); }
long long min(long long a, int b) { return min(a, (long long)b); }
long long max(long long a, int b) { return max(a, (long long)b); }
long long dx[] = {0, 0, 1, -1};
long long dy[] = {1, -1, 0, 0};
long long dxk[] = {0, 0, 1, -1, 1, 1, -1, -1};
long long dyk[] = {1, -1, 0, 0, 1, -1, 1, -1};
bool isint(double d) { return (d == floor(d)); }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long ipow(long long a, long long b) {
  if (a == 1 || b == 0) return 1;
  long long r = 1;
  for (long long i = 1; i <= b; i++) r *= a;
  return r;
}
long long power(long long a, long long b) {
  if (a == 1 || b == 0) return 1;
  long long c = power(a, b / 2);
  long long res = (c * c) % mod;
  ;
  if (b % 2) res = (res * (a % mod)) % mod;
  return res;
}
bool isPrime(int n) {
  if (n == 1) return false;
  for (int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
string toBase(int n, int b) {
  string oval = "";
  while (n >= 1) {
    if (n % b < 10)
      oval += to_string(n % b);
    else
      oval += 'A' + (n % b - 10);
    n /= b;
  }
  reverse(oval.begin(), oval.end());
  return oval;
}
int logtwo(long long n) {
  int res = 0;
  while (n % 2 == 0) n /= 2, res++;
  return res;
}
long long cal(long long n) {
  if (n == 0) return 0;
  if (n == 1) return 1;
  if (n % 4 == 0 && n > 4) return cal(n - 2) + 1;
  if (n % 2 == 0) return n / 2 + n / 2 - cal(n / 2);
  return 1 + n - 1 - cal(n - 1);
}
void Solve() {
  long long n;
  cin >> n;
  cout << cal(n) << '\n';
}
int main() {
  if (!TEST) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  }
  int t;
  cin >> t;
  while (t--) Solve();
  if (TEST) {
    cout << '\n';
    system("pause");
  }
  return 0;
}
