text: #include <cmath>
  #include <cstdio>
  #include <vector>
  #include <iostream>
  #include <algorithm>
  using namespace std;
  
  
  int main() {
      int T; cin >> T; while ( --T >= 0 ) {
          uint32_t integer; cin >> integer; cout << (~integer) << endl;
      }
      return 0;
  }
  