#include using namespace std; long long n , a , nrbits , coef , sol; int main() { cin >> n; for(int i = 1 ; i <= n ; i++) { cin >> a; nrbits = coef = sol = 0; while(a != 0) { if (a % 2 == 1) nrbits ++; a /= 2; coef++; } coef--; while(nrbits) { sol += pow(2,coef); coef--; nrbits--; } cout << sol << " "; } return 0; }