#include <bits/stdc++.h>
using namespace std;
long long int x, s;
long long int dp[70][2];
long long int solve(int pos, int curr) {
  if (pos >= 61) return curr == ((s >> pos) & 1);
  if (dp[pos][curr] != -1) return dp[pos][curr];
  long long int ret = 0;
  if ((x >> pos) & 1) {
    if ((s >> pos) & 1) {
      if (curr == 1)
        return 0;
      else
        ret = solve(pos + 1, 0) * 2;
    } else {
      if (curr == 0)
        return 0;
      else
        ret = solve(pos + 1, 1) * 2;
    }
  } else {
    if ((s >> pos) & 1) {
      if (curr == 1)
        ret = solve(pos + 1, 0) + solve(pos + 1, 1);
      else
        return 0;
    } else {
      if (curr == 0)
        ret = solve(pos + 1, 1) + solve(pos + 1, 0);
      else
        return 0;
    }
  }
  dp[pos][curr] = ret;
  return ret;
}
int main() {
  memset((dp), (-1), sizeof(dp));
  cin >> s >> x;
  cout << solve(0, 0) - 2 * (s == x) << "\n";
  return 0;
}
