#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = '!';
  long long z = 1, num = 0;
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') z = -1, ch = getchar();
  while (ch <= '9' && ch >= '0')
    num = (num << 3) + (num << 1) + ch - '0', ch = getchar();
  return z * num;
}
long long a[50];
int bitcount(int x) { return x == 0 ? 0 : bitcount(x / 2) + (x & 1); }
int main() {
  int T = read();
  a[1] = 1;
  for (int i = 2; i <= 35; ++i) a[i] = 2ll * a[i - 1];
  while (T--) {
    int x = read();
    int k = bitcount(x) + 1;
    printf("%lld\n", a[k]);
  }
  return 0;
}
