#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll s, x;
int main() {
  cin >> s >> x;
  ll y = s - x;
  if (y & 1 || y < 0) {
    cout << 0 << "\n";
    return 0;
  }
  y /= 2;
  ll ans = 1;
  for (int i = 63; ~i; i -= 1) {
    if (x >> i & 1) {
      if (y >> i & 1) {
        cout << 0 << "\n";
        return 0;
      }
      ans *= 2;
    }
  }
  if (!y) ans -= 2;
  cout << ans << "\n";
}
