#include <bits/stdc++.h>
using namespace std;
int N;
long long S, X, dp[60][2][2][2];
long long solve(int p, int ta, int tb, int fl) {
  if (p >= N) return (!fl && ta && tb);
  long long &res = dp[p][ta][tb][fl];
  if (res != -1) return res;
  res = 0;
  int x = (X & (1LL << p)) > 0LL;
  int s = (S & (1LL << p)) > 0LL;
  for (int i = 0; i < (int)2; i++)
    for (int j = 0; j < (int)2; j++) {
      int b = i + j;
      if ((b & 1) != x) continue;
      if (((b + fl) & 1) != s) continue;
      int nfl = (b + fl >= 2);
      res += solve(p + 1, ta | i, tb | j, nfl);
    }
  return res;
}
int main() {
  scanf("%I64d%I64d", &S, &X);
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < (int)60; i++)
    if ((1LL << i) > max(S, X)) {
      N = i;
      break;
    }
  printf("%I64d\n", solve(0, 0, 0, 0));
}
