#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int INF = 1000 * 1000 * 1000 + 322;
const long long LLINF =
    2LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL + 57;
const long long MOD = 1000 * 1000 * 1000 + 7;
const int RMOD = MOD - 2;
const int N = 100 * 1000 + 57;
const int P1M = 1336337;
const int P1K = 1009;
const long double EPS = 1e-9;
const long double PI = 3.1415926535897932384626433832795;
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const pair<T, U> &_p) {
  _out << _p.x << " " << _p.y;
  return _out;
}
template <typename T, typename U>
inline istream &operator>>(istream &_in, pair<T, U> &_p) {
  _in >> _p.x >> _p.y;
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const vector<T> &_v) {
  if (_v.empty()) return _out;
  _out << _v.front();
  for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) _out << ' ' << *_it;
  return _out;
}
template <typename T>
inline istream &operator>>(istream &_in, vector<T> &_v) {
  for (auto &_i : _v) _in >> _i;
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const set<T> &_s) {
  if (_s.empty()) return _out;
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it;
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const multiset<T> &_s) {
  if (_s.empty()) return _out;
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it;
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_set<T> &_s) {
  if (_s.empty()) return _out;
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it;
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_multiset<T> &_s) {
  if (_s.empty()) return _out;
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it;
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const map<T, U> &_m) {
  if (_m.empty()) return _out;
  _out << '(' << _m.begin()->x << ": " << _m.begin()->y << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it)
    _out << ", (" << _it->x << ": " << _it->y << ')';
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const unordered_map<T, U> &_m) {
  if (_m.empty()) return _out;
  _out << '(' << _m.begin()->x << ": " << _m.begin()->y << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it)
    _out << ", (" << _it->x << ": " << _it->y << ')';
  return _out;
}
const char *infile = "";
const char *outfile = "";
inline long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
inline long long lcm(int a, int b) {
  return (long long)a * (long long)b / gcd(a, b);
}
inline long long pwm(long long xx, long long pow, long long MD = MOD) {
  long long mlt = 1;
  while (pow) {
    if (pow & 1) {
      mlt *= xx;
      xx *= xx;
      pow >>= 1;
      xx %= MD;
      mlt %= MD;
    } else {
      pow >>= 1;
      xx *= xx;
      xx %= MD;
    }
  }
  return mlt;
}
inline long long pw(long long xx, int pow) {
  long long mlt = 1;
  while (pow) {
    if (pow & 1) {
      mlt *= xx;
      xx *= xx;
      pow >>= 1;
    } else {
      pow >>= 1;
      xx *= xx;
    }
  }
  return mlt;
}
inline long long inv(long long r) { return pwm(r, RMOD); }
inline void solve(long double tt) {
  long long sm, xr;
  cin >> sm >> xr;
  long long dl = sm - xr;
  long long dll = dl;
  long long ans = 1;
  if (dll & 1 || sm < xr) {
    cout << 0 << "\n";
    return;
  }
  for (dll >>= 1; sm; sm >>= 1, xr >>= 1LL, dll >>= 1) {
    if ((xr & 1) == 1) {
      if (dll & 1) {
        cout << 0 << "\n";
        return;
      }
      ans *= 2;
    }
  }
  if (dl == 0) ans -= 2;
  cout << ans << "\n";
}
int main() {
  long double tt = clock();
  if (*infile != '\0') freopen(infile, "r", stdin);
  if (*outfile != '\0') freopen(outfile, "w", stdout);
  cout.tie(nullptr);
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << setprecision(20);
  cout << fixed;
  solve(tt);
  return 0;
}
