#include <bits/stdc++.h>
long long s, x;
int main() {
  scanf("%I64d%I64d", &s, &x);
  long long cur = 0;
  for (long long i = 0; i < 63; ++i)
    if (x >> i & 1) cur |= 1LL << i;
  cur = s - cur;
  if (cur % 2 != 0 || ((cur / 2) & x) != 0) {
    puts("0");
    return 0;
  }
  cur /= 2;
  int k = 0;
  for (int i = 0; i < 64; ++i)
    if (x >> i & 1) ++k;
  long long sum = 1LL << (long long)k;
  if (s == x) sum -= 2;
  printf("%I64d\n", sum);
  return 0;
}
