#include <bits/stdc++.h>
using namespace std;
bool carry[100];
bool bs[100], bx[100];
int main() {
  long long s, x, i, j;
  scanf("%lld", &s);
  scanf("%lld", &x);
  if ((s & 1) != (x & 1)) return 0 * printf("%d\n", 0);
  for (i = 1; i <= 50; i++) {
    if (((1ll << i) & s) == ((1ll << i) & x))
      carry[i - 1] = 0;
    else
      carry[i - 1] = 1;
  }
  for (i = 0; i <= 50; i++) {
    bs[i] = bx[i] = 0;
    if ((1ll << i) & s) bs[i] = 1;
    if ((1ll << i) & x) bx[i] = 1;
  }
  long long ans = 1;
  for (i = 0; i <= 50; ++i) {
    if (bx[i] == 1 && bs[i] == 0 && carry[i] == 0) return 0 * printf("%d\n", 0);
    if (bx[i] == 1 && bs[i] == 1 && carry[i] == 1) return 0 * printf("%d\n", 0);
    if (bx[i] == 1) ans *= 2;
  }
  if (s == x) ans -= 2;
  printf("%lld\n", ans);
}
