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