#include <bits/stdc++.h>
using namespace std;
struct FastReader {
  FastReader operator>>(int &x) const {
    scanf("%d", &x);
    return *this;
  }
  FastReader operator>>(signed long long &x) const {
    scanf("%I64d", &x);
    return *this;
  }
  FastReader operator>>(double &x) const {
    scanf("%lf", &x);
    return *this;
  }
  FastReader operator>>(char &x) const {
    do {
      x = getchar();
    } while (x == ' ' || x == '\n');
    return *this;
  }
  FastReader operator>>(char *x) const {
    scanf("%s", x);
    return *this;
  }
} in;
struct FastWriter {
  FastWriter operator<<(const int x) const {
    printf("%d", x);
    return *this;
  }
  FastWriter operator<<(const signed long long x) const {
    printf("%I64d", x);
    return *this;
  }
  FastWriter operator<<(const double x) const {
    printf("%lf", x);
    return *this;
  }
  FastWriter operator<<(const char x) const {
    putchar(x);
    return *this;
  }
  FastWriter operator<<(const char *x) const {
    printf("%s", x);
    return *this;
  }
  FastWriter operator<<(const string x) const { return operator<<(x.c_str()); }
} out;
template <class T>
T sqr(T x) {
  return x * x;
}
signed long long s, x;
signed long long dp[61][2];
int main() {
  in >> s >> x;
  dp[0][0] = 1;
  for (int i = 0; i < 60; i++) {
    signed long long q = (s & (1LL << i));
    signed long long w = (x & (1LL << i));
    if (q == 0 && w == 0) {
      dp[i + 1][0] = dp[i][0];
      dp[i + 1][1] = dp[i][0];
    } else if (q > 0 && w == 0) {
      dp[i + 1][0] = dp[i][1];
      dp[i + 1][1] = dp[i][1];
    } else if (q == 0 && w > 0) {
      dp[i + 1][0] = 0;
      dp[i + 1][1] = 2 * dp[i][1];
    } else {
      dp[i + 1][0] = 2 * dp[i][0];
      dp[i + 1][1] = 0;
    }
  }
  signed long long ans = dp[60][0];
  if (s == x) ans -= 2;
  out << ans;
  return 0;
}
