#include <bits/stdc++.h>
using namespace std;
long long int f(long long int n) {
  long long int ans = 0;
  while (n > 0) {
    ans++;
    n = n >> 1;
  }
  return ans;
}
int main() {
  long long int s, x;
  cin >> s >> x;
  if (x == 0) {
    cout << 1LL << endl;
    return 0;
  }
  if (((s - x) % 2) != 0) {
    cout << 0 << endl;
    return 0;
  }
  long long int c2 = 0;
  long long int a = (s - x) / 2LL;
  long long int TT = a;
  if (a < 0) {
    cout << 0 << endl;
    return 0;
  }
  long long int index = 0;
  long long int tmp = 1LL;
  long long int ans = 1LL;
  long long int cases = 0;
  long long int tmpo = x;
  while (x) {
    if ((tmp & x) && !(tmp & a)) {
      ans *= 2LL;
    } else if ((tmp & x) && (tmp & a)) {
      ans = 0;
      break;
    }
    x = x >> 1LL;
    a = a >> 1LL;
  }
  if (TT == 0) {
    ans -= 2LL;
  }
  cout << ans << endl;
  return 0;
}
