#include <bits/stdc++.h>
using namespace std;
bool check(long long n, long long pos) { return (bool)(n & (1ll << pos)); }
int main() {
  long long s, x, A, cnt = 0, ans;
  scanf("%lld", &s), scanf("%lld", &x);
  A = (s - x) / 2;
  if ((s - x) & 1) {
    A++;
  }
  for (long long i = 50; i >= 0; i--) {
    if (check(x, i) and check(A, i)) {
      printf("0\n");
      exit(0);
    }
    if (check(A, i)) {
      continue;
    } else if (check(x, i)) {
      cnt++;
    }
  }
  ans = 1ll << cnt;
  if (s == x) {
    ans -= 2;
    printf("%lld\n", ans);
  } else {
    printf("%lld\n", ans);
  }
  exit(0);
}
