#include using namespace std; const int N = 85; int t, n, ans; bool vis[N]; int read() { int x = 0, p = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') p = -1; for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c & 15); return x * p; } void write(int x) { if (x >= 10) write(x / 10); putchar(x % 10 + '0'); } void writeln(int x) { if (x < 0) { putchar('-'); x = -x; } write(x); putchar('\n'); } void dfs(int t, int s) { if (t == n) { ans++; return; } int l = (s - t + n) % n; int r = (s + t) % n; if (!vis[l]) { vis[l] = 1; dfs(t + 1, l); vis[l] = 0; } if (!vis[r]) { vis[r] = 1; dfs(t + 1, r); vis[r] = 0; } } void solve() { if (n == 1) { ans = 1; return; } ans = 0; dfs(2, 1); ans <<= 1; } int main() { vis[0] = vis[1] = 1; t = read(); while (t--) { n = read(); solve(); writeln(ans); } return 0; }