#include <bits/stdc++.h>
inline long long read() {
  long long x = 0;
  char c = getchar(), f = 1;
  for (; c < '0' || '9' < c; c = getchar())
    if (c == '-') f = -1;
  for (; '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
inline void write(long long x) {
  static char buf[20];
  int len = 0;
  if (x < 0) putchar('-'), x = -x;
  for (; x; x /= 10) buf[len++] = x % 10 + '0';
  if (!len)
    putchar('0');
  else
    while (len) putchar(buf[--len]);
}
inline void writesp(long long x) {
  write(x);
  putchar(' ');
}
inline void writeln(long long x) {
  write(x);
  putchar('\n');
}
long long s, x;
int main() {
  s = read();
  x = read();
  long long A = (s - x) >> 1, B = s - A;
  if ((B & A) != A || ((s ^ x) & 1)) {
    puts("0");
    return 0;
  }
  int cnt = 0;
  for (int i = 0; i < 60; i++)
    if (!(A & (1ll << i)) && (B & (1ll << i))) ++cnt;
  if (A)
    writeln(1ll << cnt);
  else
    writeln((1ll << cnt) - 2);
  return 0;
}
