#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 6;
const int inf = 50;
long long s, x;
long long dp[N][2];
long long solve(int idx, int carry) {
  if (idx >= inf) return !carry;
  long long &ret = dp[idx][carry];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      if ((i + j + carry) % 2 != (s >> idx & 1)) continue;
      if ((i ^ j) != (x >> idx & 1)) continue;
      ret += solve(idx + 1, (i + j + carry) / 2);
    }
  }
  return ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> s >> x;
  long long ans = solve(0, 0);
  if (s == x) ans -= 2;
  cout << ans << endl;
  return 0;
}
