#include <bits/stdc++.h>
using namespace std;
const long long INF = numeric_limits<long long>::max();
const long long nax = (long long)(100001);
const long long mod = 1e9 + 7;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  cout << ((n - k < 0 || (n - k) & 1LL || ((n - k) >> 1) & k)
               ? 0
               : (1LL << __builtin_popcountll(k)) - 2 * (n == k));
  return 0;
}
