#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << p.first << " " << p.second;
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  long long int l = v.size();
  for (long long int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int second, x;
  cin >> second >> x;
  if (second < x) {
    cout << 0;
    return 0;
  }
  if ((second - x) % 2) {
    cout << 0 << "\n";
    return 0;
  }
  long long int a = (second - x) / 2;
  long long int ans = 1;
  long long int po = 1;
  long long int t = 0;
  if (second == x) t -= 2;
  while (x) {
    long long int rem = x % 2;
    x /= 2;
    if (rem == 1) {
      if (a & po) {
        cout << 0;
        return 0;
      }
      ans *= 2;
    }
    po *= 2;
  }
  cout << ans + t << "\n";
  return 0;
}
