#include <bits/stdc++.h>
using namespace std;
int a[111], an;
int b[111], bn, len;
long long dp[2][111];
void razl(long long x, int a[], int& an) {
  an = 0;
  if (x == 0) {
    a[an++] = 0;
  }
  while (x > 0) {
    a[an++] = x % 2;
    x /= 2;
  }
}
long long calc(int r, int i) {
  if (i == len) {
    return r == 0 ? 1 : 0;
  }
  long long& res = dp[r][i];
  if (res != -1) {
    return res;
  }
  res = 0;
  for (int x = 0; x < 2; x++) {
    int y = (a[i] ^ x);
    if ((x + y + r) % 2 == b[i]) {
      res += calc((x + y + r) / 2, i + 1);
    }
  }
  return res;
}
int main() {
  long long second, x;
  cin >> second >> x;
  razl(second, b, bn);
  razl(x, a, an);
  len = max(an, bn);
  memset(dp, -1, sizeof(dp));
  long long res = calc(0, 0);
  if (second == x) {
    res -= 2;
  }
  cout << res << endl;
  return 0;
}
