#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
struct Input {
  long long s, x;
  bool read() {
    if (!(cin >> s >> x)) {
      return false;
    }
    return true;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  long long ans;
  void write() { cout << ans << "\n"; }
  virtual void solve() {}
  virtual void clear() { *this = Data(); }
};
const int L = 40;
struct Solution : Data {
  long long dp[L + 1][2];
  vector<int> a, b;
  vector<int> bin(long long x) {
    vector<int> a;
    for (int i = 0; i < L; ++i) {
      a.push_back(x & 1);
      x >>= 1;
    }
    return a;
  }
  void solve() {
    a = bin(s);
    b = bin(x);
    ;
    ;
    dp[L][0] = 1;
    dp[L][1] = 0;
    for (int i = L - 1; i >= 0; --i) {
      for (int j = 0; j < 2; ++j) {
        long long& r = dp[i][j] = 0;
        if (b[i] == 0) {
          if (j != a[i]) {
            continue;
          }
          r = dp[i + 1][0] + dp[i + 1][1];
        } else {
          int k = (j + 1) & 1;
          if (k != a[i]) {
            continue;
          }
          r = dp[i + 1][(j + 1) >> 1] * 2;
        }
      }
    }
    ans = dp[0][0];
    if (s == x) {
      ans -= 2;
    }
  }
  void clear() { *this = Solution(); }
};
Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
