#include <bits/stdc++.h>
using namespace std;
long long s, x;
string S, X;
long long dp[64][2];
long long d__p(int i, int st) {
  if (i == S.size() && st)
    return 0;
  else if (i == S.size())
    return 1;
  long long &res = dp[i][st];
  if (res != -1) return res;
  res = 0;
  int x = S[i] - '0';
  int y = X[i] - '0';
  for (int a = 0; a <= 1; a++) {
    for (int b = 0; b <= 1; b++) {
      int remember = (a + b + st) > 1;
      int Sum = a + b + st;
      Sum %= 2;
      int Xor = a ^ b;
      if (Sum != x || Xor != y) continue;
      res += d__p(i + 1, remember);
    }
  }
  return res;
}
int main() {
  cin >> s >> x;
  for (int i = 63; i >= 0; i--) {
    if (s & (1LL << i))
      S += '1';
    else
      S += '0';
    if (x & (1LL << i))
      X += '1';
    else
      X += '0';
  }
  reverse(S.begin(), S.end());
  reverse(X.begin(), X.end());
  memset(dp, -1, sizeof dp);
  cout << d__p(0, 0) - 2 * (s == x);
  return 0;
}
