#include <bits/stdc++.h>
using namespace std;
int II() {
  int q;
  scanf("%d", &q);
  return q;
}
long long LII() {
  long long q;
  scanf("%lld", &q);
  return q;
}
void solve() {
  long long N, x;
  cin >> N >> x;
  long long q = N - x;
  if (q % 2 == 1)
    cout << 0 << endl;
  else {
    q /= 2LL;
    long long w = 0;
    for (long long i = 0; i < 40; i++) {
      bool b1 = (1LL << i) & q;
      bool b2 = (1LL << i) & x;
      if (b1 == b2 && b1 == 1) {
        cout << 0 << endl;
        return;
      }
      if ((1LL << i) & x) w++;
    }
    long long q = (1LL << w);
    if (N == x) q -= 2;
    cout << q << endl;
  }
}
int32_t main() {
  long long tt;
  tt = 1;
  while (tt--) {
    solve();
  }
}
