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 \le T \le 10^5)$ denotes the number of test cases.

The next $T$ lines each contain a single integer $N$ $(1 \le N \le 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:   Mr. Chanek takes one coin.  The opponent takes two coins.  Mr. Chanek takes one coin.  The opponent takes one coin. 

For the second case, the game is as follows:   Mr. Chanek takes three coins.  The opponent takes one coin.  Mr. Chanek takes one coin.  The opponent takes one coin.

Difficulty: interview

Starter code:

Solutions:
from sys import stdin, stdout
from collections import defaultdict
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	chanek = 0
	flag = 1
	while n>0:
		if n%4==0 and n!=4:
			if flag:
				chanek += 1
				n-=1
				flag = 0
			else:
				n-=1
				flag = 1
		elif n%2:
			if flag:
				chanek += 1
				n-=1
				flag = 0
			else:
				n-=1
				flag = 1
		else:
			if flag:
				chanek += n//2
				n//=2
				flag = 0
			else:
				n//=2
				flag = 1
	print(chanek)

from sys import stdin
input = stdin.readline

def max_pos_coins(n):
	a = 0
	while n != 0:
		if n == 4:
			a += 3
			n = 0
			continue
		if n % 4 == 0:
			n -= 2
			a += 1
		else:
			a += n // 2
			n = n // 2 - 1
	return a

for _ in range(int(input())):
	n = int(input())
	print(max_pos_coins(n) if n % 2 == 0 else n - max_pos_coins(n - 1))


import itertools

def f(x):
    scores = [0, 0]
    for i in itertools.cycle([0, 1]):

        if x & 1:
            scores[i] += 1
            x -= 1

        elif x == 0:
            return scores[0]

        elif x == 4 or x & 0b10:
            x >>= 1
            scores[i] += x
        else:
            x -= 1
            scores[i] += 1


N = int(input())
results = []

import sys
for n in map(f, map(int, sys.stdin.read().split())):
    results.append(n)

print('\n'.join(map(str, results)))