#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int s, x, k, q;
  int res = 0;
  cin >> s >> x;
  if (s < x) {
    cout << 0;
    return 0;
  }
  q = x;
  while (x > 0) {
    res += x % 2;
    x /= 2;
  }
  x = q;
  if (s == x && res == 1) {
    cout << 0;
    return 0;
  }
  if ((s - x) % 2 == 1) {
    cout << 0;
    return 0;
  }
  k = (s - x) / 2;
  int we = k;
  while (k > 0 && x > 0) {
    if (k % 2 == x % 2 && x % 2 == 1) {
      cout << 0;
      return 0;
    }
    k /= 2;
    x /= 2;
  }
  k = we;
  int eee = 0;
  if (k == 0) eee = 2;
  cout << (long long int)(pow(2.0, res)) - eee;
  return 0;
}
