#include <bits/stdc++.h>
using namespace std;
int popc(long long int x) {
  int cnt = 0;
  for (int i = 0; i < 50; i++) {
    if ((1ll << i) & x) cnt++;
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long int s, x;
  cin >> s >> x;
  if (s < x) {
    cout << "0\n";
    return 0;
  }
  if (s == x) {
    cout << ((1ll << (popc(s))) - 2) << endl;
    return 0;
  }
  if ((s - x) % 2 == 1) {
    cout << "0" << endl;
    return 0;
  }
  long long int rest = (s - x) / 2;
  for (int i = 0; i < 50; i++) {
    if ((((1ll << i) & x) != 0) && (((1ll << i) & rest) != 0)) {
      cout << "0\n";
      return 0;
    }
  }
  cout << (1ll << popc(x)) << endl;
  return 0;
}
