#include <bits/stdc++.h>
using namespace std;
const int nmax = 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const long long infl = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;
const int mod = 1000 * 1000 * 1000 + 7;
const long double pi = acos(-1.0);
template <typename T>
ostream& operator<<(ostream& cout, const vector<T>& a) {
  if ((int)a.size() == 0) {
    return (cout << "()");
  }
  cout << "(" << a[0];
  for (int i = 1; i < (int)a.size(); i++) {
    cout << "; " << a[i];
  }
  return (cout << ")");
}
template <typename T1, typename T2>
ostream& operator<<(ostream& cout, const pair<T1, T2>& a) {
  return cout << "(" << a.first << "; " << a.second << ")";
}
long long s, x;
vector<int> a, b;
int main() {
  cin >> s >> x;
  a.clear();
  long long answer = 1;
  bool f = false;
  if (s == x) {
    f = true;
  }
  while (s) {
    a.push_back(s % 2);
    s >>= 1;
  }
  b.clear();
  while (x) {
    b.push_back(x % 2);
    x >>= 1;
  }
  int sum = 0;
  while (a.size() < b.size()) {
    a.push_back(0);
  }
  while (b.size() < a.size()) {
    b.push_back(0);
  }
  while (a.size()) {
    if (a.back() && b.back()) {
      if (sum) {
        cout << 0 << endl;
        return 0;
      } else {
        answer *= 2;
      }
    } else if (a.back()) {
      if (sum) {
        sum = 1;
      } else {
        sum = 1;
      }
    } else if (b.back()) {
      if (sum) {
        answer *= 2;
        sum = 1;
      } else {
        cout << 0 << endl;
        return 0;
      }
    } else {
      if (sum) {
        sum = 0;
      } else {
      }
    }
    a.pop_back();
    b.pop_back();
  }
  if (sum) {
    cout << 0 << endl;
    return 0;
  }
  cout << answer - 2 * f << endl;
}
