#include <bits/stdc++.h>
using namespace std;
long long power(int num) {
  long long res = 1;
  for (int i = 0; i < num; i++) {
    res *= 2;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  long long S, X, a;
  cin >> S >> X;
  int num = 0;
  a = X;
  while (a > 0) {
    if ((a % 2) == 1) num++;
    a /= 2;
  }
  long long res = power(num);
  if (S < X) {
    cout << 0 << endl;
    return 0;
  }
  if (((S - X) % 2) == 1) {
    cout << 0 << endl;
    return 0;
  }
  long long rem = (S - X) / 2;
  if (rem == 0) {
    long long zero = 0;
    cout << max(zero, res - 2) << endl;
    return 0;
  }
  a = X;
  while (a > 0 || rem > 0) {
    if ((a % 2) == 1 && (rem % 2) == 1) {
      cout << 0 << endl;
      return 0;
    }
    a /= 2;
    rem /= 2;
  }
  cout << res << endl;
  return 0;
}
