#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t, n, k, i, j;
  cin >> t;
  while (t--) {
    cin >> n;
    j = 1;
    while (n > 0) {
      if (n % 2) j += j;
      n /= 2;
    }
    cout << j << endl;
  }
  return 0;
}
