#include <bits/stdc++.h>
using namespace std;
int n, step[100];
long long MAX = 2147483648;
long long pow(long long x) {
  int num = 2;
  for (int i = 1; i <= x; i++) num *= 2;
  return num;
}
long long sear(long long l, long long r, long long now, long long x) {
  int mid = (l + r) / 2;
  if (mid == x)
    return now;
  else if (mid > x)
    return sear(l, mid, now, x);
  else
    return sear(mid + 1, r, now + 1, x);
}
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    if (x == 0) {
      printf("1\n");
      continue;
    }
    long long m = sear(0, MAX, 0, x);
    printf("%lld\n", pow(m));
  }
  return 0;
}
