#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a;
  cin >> t;
  while (t--) {
    cin >> a;
    int p = 1, ans = 1;
    while (a >= p) {
      if ((a | p) == a) {
        ans *= 2;
      }
      p *= 2;
    }
    cout << ans << endl;
  }
  return 0;
}
