#include <bits/stdc++.h>
using namespace std;
bitset<50> s, x, nd;
long long n, ans = 0, num1 = 0;
long long pw(long long x, long long y) {
  if (y == 0) return 1;
  return x * pw(x, y - 1);
}
int main() {
  long long a, b;
  cin >> a >> b;
  s = a;
  x = b;
  nd = (a - b);
  if (nd[0] || a - b < 0) {
    cout << 0 << endl;
    return 0;
  }
  nd = (a - b) / 2;
  n = 49;
  for (; n >= 0; n--) {
    if (s[n] == 1 || x[n] == 1) {
      break;
    }
  }
  for (int i = 0; i <= n; i++) {
    if (x[i] == 0) {
      continue;
    } else {
      if (nd[i] == 1) {
        cout << 0 << endl;
        return 0;
      }
      num1++;
    }
  }
  ans = pw(2ll, num1);
  ans = ((a - b) / 2ll > 0ll) ? ans : ans - 2;
  cout << ans << endl;
  return 0;
}
