#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
const int mod = 1000000007;
int bit[100];
unordered_map<long long, int> mp;
long long fast(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b % 2) ret *= a;
    b /= 2;
    a *= a;
  }
  return ret;
}
int main() {
  long long n, x;
  scanf("%lld", &n);
  scanf("%lld", &x);
  long long cpy = x;
  long long cnt = 1;
  long long tot = 0;
  while (cpy) {
    if (cpy % 2) {
      tot++;
      bit[cnt]++;
    }
    cnt++;
    cpy /= 2;
  }
  long long mx = 1;
  cnt = 0;
  for (int i = 0; i <= 50; i++) {
    mp[mx] = cnt;
    cnt++;
    mx *= 2;
  }
  long long rem = n - x;
  if (rem % 2 || rem < 0) {
    printf("%d ", 0);
    printf("\n");
    return 0;
  }
  long long mul = fast(2, tot);
  if (rem == 0) {
    printf("%lld ", mul - (long long)2);
    printf("\n");
    return 0;
  } else {
    int flag = 0;
    rem /= 2;
    int kc = 1;
    while (rem) {
      if (rem % 2 && bit[kc]) {
        printf("%d ", 0);
        return 0;
      }
      rem /= 2;
      kc++;
    }
    printf("%lld ", mul);
    printf("\n");
  }
  return 0;
}
