#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
long long s, x, a, c;
bool b[69];
int main() {
  scanf("%I64d%I64d", &s, &x);
  a = 1;
  for (int i = 0; i <= 60; i++)
    if ((1LL << i) & x) b[i] = 1;
  for (int i = 0; i <= 60; i++)
    if (b[i]) s -= (1LL << i), a <<= 1;
  c = -2;
  for (int i = 60; i >= 0; i--)
    if (!b[i] && s >= (2LL << i)) s -= (2LL << i), c = 0;
  if (s)
    puts("0");
  else
    printf("%I64d\n", a + c);
  return 0;
}
