#include <bits/stdc++.h>
using namespace std;
string bist(long long X) {
  string res;
  while (X > 0) {
    if (X & 1)
      res.push_back('1');
    else
      res.push_back('0');
    X >>= 1;
  }
  reverse(res.begin(), res.end());
  return res;
}
long long solve(long long S, long long X, int bit) {
  ;
  long long ans;
  if (X == 0 && (S & 1))
    return 0;
  else if (X == 0)
    return 1;
  if (bit == 1) {
    if (S == 0 && X == 0)
      ans = 1;
    else if (S == 1 && X == 1)
      ans = 2;
    else if (S == 1 && X == 0)
      ans = 0;
    else
      ans = 0;
  } else {
    int lX = X & 1, lS = S & 1;
    if (lX != lS)
      ans = 0;
    else if (lX == 0 && lS == 0) {
      auto A = solve(S >> 1, X >> 1, bit - 1);
      auto B = solve((S >> 1) - 1, X >> 1, bit - 1);
      ans = A + B;
    } else {
      ans = solve(S >> 1, X >> 1, bit - 1);
      ans *= 2;
    }
  };
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long S, X;
  cin >> S >> X;
  long long res = solve(S, X, 40);
  if (S == X) res -= 2;
  cout << res << "\n";
}
