#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pci = pair<char, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
const ll infll = 1e18 + 3;
const int maxn = 1e6 + 77;
const int nmax = 1e6 + 77;
const ll basell = 1e18 + 3;
const int mod = 1e9 + 7;
const ld eps = 1e-7;
const int inf = 1009000999;
const int nv = 100505;
const int baseint = 1000200013;
const ld PI = acos(-1.0);
inline bool EQ(ld a, ld b) { return fabs(a - b) < 1e-9; }
ll stp[62];
int inline solve() {
  ios::sync_with_stdio(NULL), cin.tie(NULL), cout.tie(NULL);
  ;
  ll s, x;
  cin >> s >> x;
  ll ans = 1;
  stp[0] = 1;
  for (int i = 1; i < 61; i++) stp[i] = stp[i - 1] * 2;
  for (ll i = 59; i >= 0; --i) {
    ll a = stp[i];
    if (a & x) ans *= 2;
  }
  s -= x;
  if (s == 0) {
    cout << ans - 2;
    return 0;
  }
  for (int i = 59; i >= 0; --i) {
    ll a = stp[i];
    if (!(a & x) && s >= a * 2) s -= a * 2;
  }
  if (s == 0)
    cout << ans;
  else
    cout << 0;
  return 0;
}
int32_t main() {
  solve();
  return 0;
}
