#include <bits/stdc++.h>
using namespace std;
const int N = 100002;
const int oo = 1000000007;
template <typename T>
inline void maximize(T &__x, const T &__y) {
  __x = max(__x, __y);
}
template <typename T>
inline void minimize(T &__x, const T &__y) {
  __x = min(__x, __y);
}
long long f0[N], f1[N];
vector<int> s, x;
int main() {
  long long ss, xx;
  scanf("%I64d %I64d", &ss, &xx);
  int ans;
  if (xx == ss)
    ans = -2;
  else
    ans = 0;
  if (xx == 0) x.push_back(0);
  while (ss != 0) {
    s.push_back(ss % 2);
    ss /= 2;
  }
  while (xx != 0) {
    x.push_back(xx % 2);
    xx /= 2;
  }
  while (s.size() < x.size()) s.push_back(0);
  while (x.size() < s.size()) x.push_back(0);
  if (x[0] == s[0])
    if (x[0] == 0)
      f0[0] = f1[0] = 1;
    else
      f0[0] = 2;
  for (int n = (1); n <= (s.size() - 1); ++n) {
    f0[n] = f1[n] = 1;
    if (x[n] == 0) {
      if (s[n] == 0) {
        f0[n] *= f0[n - 1];
        f1[n] *= f0[n - 1];
      } else {
        f0[n] *= f1[n - 1];
        f1[n] *= f1[n - 1];
      }
    } else {
      if (s[n] == 0) {
        f0[n] = 0;
        f1[n] = 2 * f1[n - 1];
      } else {
        f0[n] = 2 * f0[n - 1];
        f1[n] = 0;
      }
    }
  }
  printf("%I64d", f0[s.size() - 1] + ans);
}
