#include <bits/stdc++.h>
using namespace std;
template <class T, class S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  return os << "(" << v.first << ", " << v.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (int i = int(0); i <= int((static_cast<int>((v).size())) - 1); ++i) {
    if (i) os << ", ";
    os << v[i];
  }
  return os << "]";
}
template <class T>
bool setmax(T& _a, T _b) {
  if (_a < _b) {
    _a = _b;
    return true;
  }
  return false;
}
template <class T>
bool setmin(T& _a, T _b) {
  if (_b < _a) {
    _a = _b;
    return true;
  }
  return false;
}
template <class T>
T gcd(T _a, T _b) {
  return _b == 0 ? _a : gcd(_b, _a % _b);
}
vector<int> parse(long long x) {
  vector<int> a;
  while (x > 0) {
    a.push_back(int(x % 2));
    x /= 2;
  }
  return a;
}
long long solve() {
  long long vs, vx;
  cin >> vs >> vx;
  vector<int> s = parse(vs), x = parse(vx);
  if (static_cast<int>((x).size()) > static_cast<int>((s).size())) return 0;
  x.resize(static_cast<int>((s).size()));
  vector<vector<long long> > f(static_cast<int>((s).size()) + 1,
                               vector<long long>(2));
  f[0][0] = 1;
  for (int i = int(0); i <= int((static_cast<int>((s).size())) - 1); ++i)
    for (int carry = int(0); carry <= int((2) - 1); ++carry) {
      for (int u = int(0); u <= int((2) - 1); ++u)
        for (int v = int(0); v <= int((2) - 1); ++v) {
          if ((u ^ v) != x[i]) continue;
          if ((u + v + carry) % 2 != s[i]) continue;
          f[i + 1][(u + v + carry) >> 1] += f[i][carry];
        }
    }
  long long ans = f[static_cast<int>((s).size())][0];
  if (vs == vx) ans -= 2;
  return ans;
}
int main() {
  long long ans = solve();
  cout << ans << endl;
  return 0;
}
