#include #include using namespace std; long long findLastBiscuit(long long N) { long long L = 1; while (L * 2 <= N) { L *= 2; } long long D = N - L; return 2 * D + 1; } int main() { #ifdef ONLINE_JUDGE /// promeni freopen("biscuits.in", "r", stdin); freopen("biscuits.out", "w", stdout); #endif int T; cin >> T; for (int i = 0; i < T; ++i) { long long N; cin >> N; long long result = findLastBiscuit(N); cout << result << endl; } return 0; }