#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  int c1 = 0;
  long long ms = 0;
  bool wt = false;
  for (int i = 60; i >= 0; i--) {
    if (x & (1LL << i)) {
      c1++;
      ms += 1LL << i;
    } else {
      if (ms + (2LL << i) <= s) {
        ms += 2LL << i;
        wt = true;
      }
    }
  }
  if (ms != s) {
    cout << 0;
    return 0;
  }
  if (wt) {
    cout << (1LL << c1);
  } else {
    cout << ((1LL << c1) - 2);
  }
  return 0;
}
