#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  if ((s - x) < 0 || (s - x) % 2 || ((s - x) / 2 & x)) return cout << 0, 0;
  long long bits = (long long)1 << __builtin_popcountll(x);
  if (s == x) bits -= 2;
  cout << bits;
}
