#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, y = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') y = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * y;
}
void put(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) put(x / 10);
  putchar((x % 10) + 48);
}
long long s, x;
signed main() {
  while (scanf("%lld%lld", &s, &x) != EOF) {
    long long sum = (s - x) / 2, cnt = 0;
    if (x > s || sum * 2 + x != s || (x & sum) != 0) {
      puts("0");
      continue;
    }
    for (; x; x >>= 1)
      if (x & 1) ++cnt;
    long long ans = 1LL << cnt;
    if (!sum) ans -= 2;
    printf("%lld\n", ans);
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
