#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int s, x;
  cin >> s >> x;
  if (s < x || (s - x) % 2 == 1 || (s - x) / 2 & x) {
    cout << 0 << endl;
    return 0;
  }
  long long int k = __builtin_popcountll(x);
  k = 1LL << k;
  if (s == x) k -= 2;
  cout << k << endl;
  return 0;
}
