#include <bits/stdc++.h>
using namespace std;
long long naive_check(long long s, long long x) {
  long long ans = 0;
  for (long long i = 1LL; i < s; ++i) {
    long long j = s - i;
    if ((i ^ j) == x) ans++;
  }
  return ans;
}
int pop_count(long long x) {
  int ret = 0;
  while (x) ret += (x & 1LL), x >>= 1;
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  long long s, x, c_i, c_o;
  while (cin >> s >> x) {
    c_i = x ^ s;
    c_o = c_i >> 1;
    long long ans = 1LL << (pop_count(x));
    if (x > s || (x & (c_o ^ (c_i & x))) || (c_i & 1LL))
      ans = 0;
    else if (((~x) & c_o) == 0)
      ans -= 2;
    cout << ans << "\n";
  }
  return 0;
}
