#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
const int maxn = 2e5 + 9;
const int mod = 1e9 + 7;
template <class T>
inline void sc(T &ret) {
  char c;
  ret = 0;
  while ((c = getchar()) < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + (c - '0'), c = getchar();
  }
}
int main() {
  long long s, x;
  cin >> s >> x;
  bool f = 0;
  if (s == x) f = 1;
  if (s < x) {
    cout << 0 << endl;
    return 0;
  }
  s -= x;
  if (s % 2) {
    cout << 0 << endl;
    return 0;
  }
  s /= 2;
  long long ans = 1;
  for (int i = 0; i < 61; i++) {
    int k = (s >> i) & 1;
    int kk = (x >> i) & 1;
    if (k == kk && k == 1) {
      cout << 0 << endl;
      return 0;
    }
    if (kk == 1) ans *= 2;
  }
  if (!f)
    cout << ans << endl;
  else
    cout << ans - 2 << endl;
  return 0;
}
