#include <bits/stdc++.h>
using namespace std;
long long s, x, Ans;
bool valid(long long n) {
  if (n % 2) return false;
  n = n >> 1;
  for (long long i = 0; i < 58; ++i) {
    if ((n & (1LL << i)) and (x & (1LL << i))) return false;
  }
  return true;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> x;
  Ans = valid(s - x);
  for (long long i = 0; i < 50; ++i)
    if (x & (1LL << i)) Ans = Ans << 1;
  if (s == x) Ans -= 2;
  cout << Ans;
  return 0;
}
