#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  long long r = s - x;
  if (r < 0) {
    cout << 0 << endl;
    return 0;
  }
  long long k = __builtin_popcountll(x);
  long long ans = (1ll << k);
  if (r == 0) {
    cout << max(ans - 2, 1ll * 0);
    return 0;
  }
  if ((r % 2 != 0)) {
    cout << 0 << endl;
    return 0;
  }
  if ((((r / 2) & x) != 0)) {
    cout << 0 << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}
