#include using namespace std; using ll=long long; unordered_mapM; ll S(ll N){ if(M.count(N))return M[N]; M[N]=S(N/2)+S((N-1)/4)+S((N+1)/4)+(N+1)/2; return M[N]; } int main() { ll T; cin>>T; assert(1<=T&&T<=1e4); M[0]=0; while(T--) { ll N; cin>>N; assert(1<=N&&N<=1e17); cout<