#include using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i> X; for(ll m = 1LL; m < 64LL; ++m){ ll n = X ^ m; ll cnt = 0; rep(i, 0, 64){ if(n & (1LL << i)){ cnt++; } } if(cnt == m){ cout << n << endl; return 0; } } cout << -1 << endl; return 0; }