#include <bits/stdc++.h>
using namespace std;
int a[200007], b[200007];
int main() {
  long long s, x;
  cin >> s >> x;
  long long a = (s - x) / 2;
  if (a < 0 || x + 2 * a != s || (x & a) != 0) {
    printf("0\n");
    return 0;
  }
  long long bits = 0;
  while (x > 0) {
    bits += x & 1;
    x >>= 1;
  }
  long long ans = 1LL << bits;
  if (a == 0) ans -= 2;
  printf("%I64d\n", ans);
  return 0;
}
