#include #include #include #include #include #include #include #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(0); long long T, n; vector vec; cin >> T; while (T--) { vec.clear(); long long ans = 0,step = 1; cin >> n; while (n) { vec.push_back(n%2); n /= 2; } reverse(vec.begin(), vec.end()); for (int i = 0; i < vec.size(); ++i) { ans += vec[i]*step; step *= 2; } cout << ans << endl; } return 0; }