#include <bits/stdc++.h>
using namespace std;
long long dp[45][2][2][2], s, x;
long long dfs(int n, int rem, int b1, int b2) {
  if (n == 41) {
    if (rem == 0 && b1 == 1 && b2 == 1)
      return 1;
    else
      return 0;
  }
  if (dp[n][rem][b1][b2] != -1) return dp[n][rem][b1][b2];
  long long &res = dp[n][rem][b1][b2];
  res = 0;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      int v1 = i + j + rem, v2 = (i ^ j);
      if ((((s >> n) & 1) == v1 % 2) && (((x >> n) & 1) == v2 % 2)) {
        int c1 = b1, c2 = b2;
        if (i == 1) c1 = 1;
        if (j == 1) c2 = 1;
        res += dfs(n + 1, v1 / 2, c1, c2);
      }
    }
  }
  return res;
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%lld%lld", &s, &x);
  printf("%lld\n", dfs(0, 0, 0, 0));
}
