#include <bits/stdc++.h>
using namespace std;
long long s, x;
long long dp[55][2];
long long f(long long idx, long long carry) {
  if ((1LL << idx) > s) return carry ^ 1LL;
  if (~dp[idx][carry]) return dp[idx][carry];
  long long res = 0;
  if ((x >> idx) & 1LL) {
    if ((s >> idx) & 1LL) {
      if (!carry) res = 2LL * f(idx + 1, 0);
    } else {
      if (carry) res = 2LL * f(idx + 1, 1);
    }
  } else {
    if ((s >> idx) & 1LL) {
      if (carry) res = f(idx + 1, 0) + f(idx + 1, 1);
    } else {
      if (!carry) res = f(idx + 1, 0) + f(idx + 1, 1);
    }
  }
  return dp[idx][carry] = res;
}
int32_t main() {
  cin >> s >> x;
  if (s < x) {
    cout << 0 << endl;
    return 0;
  }
  memset(dp, -1, sizeof dp);
  cout << f(0, 0) - 2LL * (s == x) << endl;
}
