#include <bits/stdc++.h>
using namespace std;
string convert_to_binary(long long num) {
  string binary;
  binary.clear();
  while (num >= 2) {
    binary += to_string(num % 2);
    num /= 2;
  }
  binary += to_string(num);
  return binary;
}
int main1(void) {
  long long a = 176901202458;
  long long b = 21535662096;
  cout << convert_to_binary(a) << "\n" << convert_to_binary(b) << endl;
  cout << convert_to_binary(a ^ b) << endl;
  cout << convert_to_binary(a & b) << endl;
  cout << (a & b) << endl;
  cout << (a ^ b) << endl;
  return 0;
}
int main(void) {
  unsigned long long s, x, a;
  int count = 0;
  cin >> s >> x;
  a = (s - x) / 2;
  if ((s < x) || ((s - x) % 2 != 0)) {
    cout << "0" << endl;
    return 0;
  } else if ((a & x) != 0) {
    cout << "0" << endl;
    return 0;
  } else {
    string bin = convert_to_binary(x);
    for (int i = 0; i < bin.length(); i++) {
      if (bin[i] == '1') count++;
    }
  }
  unsigned long long result = pow(2, count);
  if (s == x)
    cout << result - 2 << endl;
  else
    cout << result << endl;
  return 0;
}
