#include <bits/stdc++.h>
using namespace std;
long long int pow_mod(long long int a, long long int b) {
  long long int res = 1;
  while (b != 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
    }
    a = (a * a) % 1000000007;
    b /= 2;
  }
  return res;
}
void solve() {
  long long int s, x;
  cin >> s >> x;
  if ((s - x) % 2 == 1) {
    cout << "0";
    return;
  }
  long long int c, d;
  c = (s - x) / 2;
  d = x;
  if (c & d) {
    cout << "0";
    return;
  }
  long long int ans = 1;
  long long int y = 0;
  bool flag = true;
  for (long long int i = 0; i < 44; i++) {
    if (((c & (1LL << i)) == 0) && (d & (1LL << i))) y++;
  }
  ans = 1LL << y;
  if (s == x) ans -= 2;
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) solve();
  return 0;
}
