#include <bits/stdc++.h>
using namespace std;
const int N = 500023;
vector<int> adj[N];
void solve() {
  long long int s, x;
  cin >> s >> x;
  vector<long long int> bits;
  long long int index = 0;
  long long int ans = 1;
  if (x == 0) {
    cout << 1;
    return;
  }
  while (1) {
    long long int temp = (long long int)1 << index;
    index++;
    if (temp > x) break;
    if ((x & temp) != 0) {
      bits.push_back(1);
      ans *= 2;
    } else
      bits.push_back(0);
  }
  long long int temp = s - x;
  if (temp % 2 == 1) {
    cout << 0;
    return;
  }
  if (temp < 0) {
    cout << 0;
    return;
  }
  temp /= 2;
  vector<long long int> bits2;
  index = 0;
  while (1) {
    long long int temp1 = (long long int)1 << index;
    if (temp1 > temp) break;
    if ((temp & temp1) != 0) {
      bits2.push_back(1);
    } else
      bits2.push_back(0);
    index++;
  }
  for (int i = 0; i < min(bits.size(), bits2.size()); i++) {
    if (bits[i] == 1 && bits2[i] == 1) {
      cout << 0;
      return;
    }
  }
  long long int flag = 0;
  for (int i = 0; i < bits.size(); i++) {
    if (bits[i] == 0) flag = 1;
  }
  if (flag == 0 || ((s - x) == 0)) ans -= 2;
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  int t = 0;
  while (t++ < T) {
    solve();
  }
}
