/* -*- coding: utf-8 -*- * * 3276.cc: No.3276 Make Smaller Popcount - yukicoder */ #include #include using namespace std; /* constant */ const int BN = 30; /* typedef */ /* global variables */ int bs[BN]; /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int n; scanf("%d", &n); int k = 0; for (int i = 0; i < BN; i++) if ((n >> i) & 1) bs[k++] = i; if (k >= 2) { int x = (1 << bs[1]) - (1 << bs[0]); printf("%d\n", x); } else puts("-1"); } return 0; }