#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  bool f = (s == x);
  long long cnt = 1;
  while (s > 0) {
    int cs = s % 2;
    int cx = x % 2;
    if (cx == cs) {
      s /= 2;
      x /= 2;
      if (cx == 1)
        cnt *= 2;
      else if (x % 2 != s % 2)
        s--;
    } else {
      cnt = 0;
      s = 0;
    }
  }
  if (f) cnt -= 2;
  if (x != 0) cnt = 0;
  cout << cnt << "\n";
  return 0;
}
