#include <bits/stdc++.h>
int main() {
  long long x, n;
  scanf("%lld%lld", &x, &n);
  if (x < n || ((x - n) & 1) != 0) {
    puts("0");
    return 0;
  }
  x = (x - n) >> 1;
  bool all = n != 0, fuck = x == 0;
  int cnt = 0;
  for (; n != 0; n >>= 1, x >>= 1) {
    if ((n & 1) && !(x & 1)) {
      ++cnt;
    } else if (!(n & 1)) {
      all = false;
    } else {
      puts("0");
      return 0;
    }
  }
  long long ans = 1;
  for (; cnt != 0; --cnt) ans <<= 1;
  if (all || fuck) {
    ans -= 2;
  }
  printf("%lld", ans);
  return 0;
}
