#include <bits/stdc++.h>
using namespace std;
const int MAX = 100;
long long dp[MAX + 1][2];
int a[MAX + 1], b[MAX + 1];
int main() {
  long long s, x;
  scanf("%lld%lld", &s, &x);
  bool more = false;
  if (s == x) more = true;
  for (int i = 1; i <= MAX; i++) {
    a[i] = s % 2;
    s /= 2;
  }
  for (int i = 1; i <= MAX; i++) {
    b[i] = x % 2;
    x /= 2;
  }
  dp[0][0] = 1;
  for (int len = 0; len < MAX; len++) {
    for (int more = 0; more < 2; more++) {
      for (int gox = 0; gox <= 1; gox++) {
        for (int goy = 0; goy <= 1; goy++) {
          if ((gox ^ goy) != b[len + 1]) continue;
          int sum = gox + goy + more;
          if ((sum % 2) != a[len + 1]) continue;
          int goMore = 0;
          if (sum >= 2) {
            goMore = 1;
            sum -= 2;
          }
          dp[len + 1][goMore] += dp[len][more];
        }
      }
    }
  }
  long long ans = dp[MAX][0];
  if (more) {
    ans -= 2;
  }
  printf("%lld\n", ans);
}
