#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, xx, x;
  cin >> s >> xx;
  x = xx;
  long long t = (s - x) / 2;
  long long ans = 0, ans1 = 0;
  bool ok = 1, haveo = 0;
  while (t > 0 || x > 0) {
    if ((x & 1) == 1) haveo = 1;
    if ((t & 1) == 1 && (x & 1) == 1) {
      ok = 0;
      break;
    }
    if ((t & 1) == 0 && (x & 1) == 1) {
      ans++;
    }
    t >>= 1;
    x >>= 1;
  }
  if (!ok || s < xx || (s - xx) % 2 == 1)
    cout << "0" << endl;
  else {
    ans = 1ll << ans;
    if (s - xx == 0) ans -= 2;
    cout << ans << endl;
  }
  return 0;
}
