#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x, diff, ans = 1;
  scanf("%lld%lld", &s, &x);
  diff = s - x;
  if (s < x || (diff & 1)) {
    printf("0\n");
    return 0;
  }
  for (int i = 1; i <= 60; i++) {
    if ((x >> i - 1 & 1) && (diff >> i & 1) == 0) ans <<= 1;
    if ((x >> i - 1 & 1) && (diff >> i & 1)) {
      printf("0\n");
      return 0;
    }
  }
  if (!diff) {
    ans -= 2;
  }
  printf("%lld\n", ans);
  return 0;
}
