#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  long long a = (s - x) / 2;
  if (a < 0 || a * 2 + x != s || (x & a) != 0) {
    cout << 0 << endl;
    return 0;
  }
  long long p = x, b = 0;
  while (p > 0) {
    b += (p & 1);
    p >>= 1;
  }
  long long ans = 1LL << b;
  if (a == 0) ans -= 2;
  cout << ans << endl;
  return 0;
}
