#include <bits/stdc++.h>
using namespace std;
int ary1[100], ary2[100];
long long dp[100][2][2][2];
bool check(long long s, long long x) {
  if (s == x)
    return true;
  else
    return false;
}
int main() {
  long long s, x;
  int i, j, next = 0;
  while (scanf("%I64d%I64d", &s, &x) != EOF) {
    memset(dp, 0, sizeof(dp));
    memset(ary1, 0, sizeof(ary1));
    memset(ary2, 0, sizeof(ary2));
    long long temp1 = s, temp2 = x;
    next = 0;
    while (s > 0) {
      ary1[next] = s % 2;
      s /= 2;
      next++;
    }
    next = 0;
    while (x > 0) {
      ary2[next] = x % 2;
      x /= 2;
      next++;
    }
    for (i = 0; i < 60; i++) {
      if (i == 0) {
        for (int value1 = 0; value1 <= 1; value1++)
          for (int value2 = 0; value2 <= 1; value2++) {
            if (((value1 + value2) % 2 == ary1[i]) &&
                (value1 ^ value2) == ary2[i])
              dp[i][value1][value2][(value1 + value2) / 2] = 1;
          }
      } else {
        for (int value1 = 0; value1 <= 1; value1++)
          for (int value2 = 0; value2 <= 1; value2++) {
            for (int prev_value1 = 0; prev_value1 <= 1; prev_value1++)
              for (int prev_value2 = 0; prev_value2 <= 1; prev_value2++) {
                for (int add = 0; add <= 1; add++) {
                  if (((value1 + value2 + add) % 2 == ary1[i]) &&
                      (value1 ^ value2) == ary2[i]) {
                    int next_add = (value1 + value2 + add) / 2;
                    dp[i][value1][value2][next_add] +=
                        dp[i - 1][prev_value1][prev_value2][add];
                  }
                }
              }
          }
      }
    }
    long long ans = dp[59][0][0][0];
    if (check(temp1, temp2)) ans -= 2;
    printf("%I64d\n", ans);
  }
  return 0;
}
