#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int main() {
  long long s, x;
  cin >> s >> x;
  long long a = s & x;
  long long tmp = s - x;
  long long ans = 0;
  if (tmp < 0 || tmp & 1 || ((tmp / 2) & x) != 0) {
    cout << 0 << endl;
    return 0;
  } else {
    tmp /= 2;
    long long setbits = 0;
    while (x) {
      setbits += (1 & x);
      x >>= 1;
    }
    ans = 1LL << setbits;
  }
  if (tmp == 0) ans -= 2;
  cout << ans << endl;
  return 0;
}
