#include using namespace std; using ll=long long; unordered_mapM; ll S(ll N){ if(N <= 0)return 0; 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; while(T--) { ll N; cin>>N; M.clear(); cout<