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