#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  long long rem = 0;
  if (s == x) rem = 2;
  long long ans = 1;
  for (int i = 45; i >= 0; --i) {
    if (x & (1LL << i)) {
      ans *= 2;
      s -= (1LL << i);
      if (s < 0) ans = 0;
    } else {
      long long take = 2 * (1LL << i);
      if (take <= s) s -= take;
    }
  }
  if (s != 0) ans = 0;
  cout << ans - rem << '\n';
  return 0;
}
