#include <bits/stdc++.h>
using namespace std;
long long s, x;
int mx;
long long dp[100][2];
long long doit(int cur, int carry) {
  if (cur >= mx) {
    if (carry == 0) {
      return 1;
    } else
      return 0;
  }
  if (dp[cur][carry] != -1) return dp[cur][carry];
  long long pos;
  if ((x & (1LL << cur)) > 0) {
    int ca = (carry + 1) / 2;
    if ((carry + 1) % 2 == ((s & (1LL << cur)) >> cur))
      pos = 2 * doit(cur + 1, ca);
    else
      pos = 0;
  } else {
    pos = 0;
    int ca = (carry + 2) / 2;
    if ((carry + 2) % 2 == ((s & (1LL << cur)) >> cur)) pos = doit(cur + 1, ca);
    if ((carry) % 2 == ((s & (1LL << cur)) >> cur)) {
      ca = (carry) / 2;
      pos += doit(cur + 1, ca);
    }
  }
  return dp[cur][carry] = pos;
}
int main() {
  scanf("%lld%lld", &s, &x);
  mx = 61;
  int i, j;
  for (i = 0; i < 100; i++) dp[i][0] = dp[i][1] = -1LL;
  long long ans = doit(0, 0);
  if (s == x) {
    ans = max(0LL, ans - 2);
  }
  printf("%lld\n", ans);
  return 0;
}
