#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const long long LLINF = (long long)1e18;
const int LOG = 17;
const int N = (int)2e5 + 5;
const double PI = 3.141592653589793;
const double eps = 0.000005;
void operator delete(void* a) {}
void operator delete[](void* a) {}
long long s, x;
int main() {
  cin >> s >> x;
  if (s < 0 || (s - x) & 1) {
    return puts("0"), 0;
  }
  s = (s - x) >> 1;
  long long ans = 1ll;
  for (int i = 0; i < 63; ++i) {
    if (((x >> i) & 1) == 1) {
      if (((s >> i) & 1) == 1) {
        return puts("0"), 0;
      }
      ans *= 2;
    }
  }
  if (!s) {
    ans -= 2;
  }
  cout << ans;
  return 0;
}
