#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, t, cnt = 0;
  cin >> n >> k;
  t = n - k;
  if (t & 1 || t < 0 || (t >> 1) & k) {
    cout << 0;
  } else {
    long long kk = k;
    while (kk > 0) {
      cnt += kk & 1ll;
      kk >>= 1ll;
    }
    cout << (1ll << cnt) - 2ll * (n == k);
  }
  return 0;
}
