#include <bits/stdc++.h>
using namespace std;
long long s, x;
int main() {
  while (scanf("%I64d%I64d", &s, &x) == 2) {
    long long a = (s - x) / 2;
    if (x > s || a * 2 + x != s || (x & a) != 0) {
      printf("0\n");
      continue;
    }
    long long bit = 0;
    while (x) {
      if (x & 1) bit++;
      x >>= 1;
    }
    long long res = 1ll << bit;
    if (a == 0) res -= 2;
    printf("%I64d\n", res);
  }
  return 0;
}
