#include <bits/stdc++.h>
using namespace std;
long long s, x;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> x;
  bool ok = false;
  if (s == x) ok = 1;
  if (s < x || (s - x) / 2 & x || (s - x) % 2) return cout << 0 << endl, 0;
  s -= x, s /= 2;
  long long ans = 1;
  while (x) {
    if (x & 1) ans *= (long long)2;
    x /= 2;
  }
  cout << ans - 2 * ok << endl;
  return 0;
}
