#include <bits/stdc++.h>
using namespace std;
long long bit(long long u) { return (1LL << u); }
int main() {
  long long s, x;
  cin >> s >> x;
  if ((s - x) % 2 == 1)
    cout << 0 << endl;
  else {
    long long k = (s - x) / 2, res = 1;
    for (long long i = 50; i >= 0; i--) {
      if ((bit(i) & x) and (bit(i) & k)) {
        cout << 0 << endl;
        return 0;
      }
      if (bit(i) & k) continue;
      if (bit(i) & x) res *= 2;
    }
    if (s == x) res -= 2;
    cout << res << endl;
  }
  return 0;
}
