#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  if ((s - x) & 1 || s - x < 0) {
    cout << "0" << endl;
    return 0;
  }
  long long k = (s - x) >> 1;
  long long tmp = x;
  long long cnt = 0;
  while (tmp) {
    cnt++;
    tmp = tmp >> 1;
  }
  long long ans = 1;
  for (long long i = 0; i < cnt; i++) {
    long long a = (x >> i) & 1;
    long long b = (k >> i) & 1;
    if (a == 1) {
      if (b == 0)
        ans *= 2;
      else {
        ans = 0;
        break;
      }
    }
  }
  if (!k) ans -= 2;
  cout << ans << endl;
  return 0;
}
