#include <bits/stdc++.h>
long long read() {
  long long res = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) res = res * 10 + ch - 48, ch = getchar();
  return res * flag;
}
void print(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + 48);
}
long long s, x;
long long qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}
long long count(long long x) {
  long long res = 0;
  while (x) res += x & 1, x >>= 1;
  return res;
}
void solution() {
  s = read(), x = read();
  42;
  print((s < x || ((s - x) & (x << 1 | 1)))
            ? 0
            : qpow(2, count(x)) - ((s == x) * 2)),
      puts("");
}
signed main() {
  42;
  solution();
}
