#include <bits/stdc++.h>
using namespace std;
long long dp[100][2][2][2];
int main() {
  long long s, x;
  scanf("%lld%lld", &s, &x);
  int i = 0;
  if (s % 2 == 1 && x % 2 == 1) dp[0][0][1][0] = dp[0][1][0][0] = 1;
  if (s % 2 == 0 && x % 2 == 0) dp[0][0][0][0] = dp[0][1][1][0] = 1;
  int del = 0;
  if (s == x && s != 0) del = -2;
  if (s == x && s == 0) del = -1;
  for (i = 0; s + x; ++i) {
    for (int a = 0; a < 2; ++a)
      for (int b = 0; b < 2; ++b) {
        if (a ^ b != x % 2) continue;
        for (int p = 0; p < 2; ++p) {
          if ((a + b + p) % 2 != s % 2) continue;
          for (int na = 0; na < 2; ++na)
            for (int nb = 0; nb < 2; ++nb)
              dp[i + 1][na][nb][(a + b + p) / 2] += dp[i][a][b][p];
        }
      }
    s >>= 1;
    x >>= 1;
  }
  dp[i][0][0][0] = max(0LL, dp[i][0][0][0] + del);
  printf("%lld\n", dp[i][0][0][0]);
  return 0;
}
