#include <bits/stdc++.h>
using namespace std;
long long s, x;
long long dp[41][2];
long long fun(int i, bool crr) {
  if (i == 41) return !crr;
  if (dp[i][crr] != -1) return dp[i][crr];
  long long res = 0;
  if (((long long)(1ll << (long long)i)) & x) {
    if (!crr && (((long long)(1ll << (long long)i)) & s)) {
      res += (2ll * fun(i + 1, 0));
    } else if (!(((long long)(1ll << (long long)i)) & s) && crr) {
      res += (2ll * fun(i + 1, 1));
    }
  } else {
    if (!crr && !(((long long)(1ll << (long long)i)) & s)) {
      res += fun(i + 1, 0);
      res += fun(i + 1, 1);
    } else if ((((long long)(1ll << (long long)i)) & s) && crr) {
      res += fun(i + 1, 1);
      res += fun(i + 1, 0);
    }
  }
  return dp[i][crr] = res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s >> x;
  memset(dp, -1, sizeof dp);
  long long res = fun(0, 0);
  if (s == x) res -= 2;
  cout << res << endl;
  return 0;
}
