#include <bits/stdc++.h>
using namespace std;
int main() {
  long long sum, x;
  cin >> sum >> x;
  long long a = (sum - x) / 2;
  if (a < 0 || a * 2 + x != sum || (a & x) != 0) {
    cout << 0 << endl;
    return 0;
  }
  int t = 0;
  while (x) {
    t += (x & 1);
    x >>= 1;
  }
  long long ans = 1ll << t;
  if (a == 0) ans -= 2;
  cout << ans << endl;
}
