#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  long long ans = __builtin_popcountll(x);
  ans = 1LL << ans;
  if (s == x) ans -= 2;
  for (int i = 0; i < 60; i++) {
    if (x & (1LL << i)) s -= 1LL << i;
  }
  for (int i = 0; i < 60; i++) {
    int j = i + 1;
    if ((s & (1LL << j)) && !(x & (1LL << i))) s -= 1LL << j;
  }
  if (s != 0)
    puts("0");
  else
    cout << ans << endl;
}
