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