#include <bits/stdc++.h>
using namespace std;
const long long MAXL = 40 + 11;
bool mark[MAXL];
vector<long long> bin(long long n) {
  vector<long long> ans;
  if (n == 0) {
    ans.push_back(0);
    return ans;
  }
  while (n > 0) {
    ans.push_back(n % 2);
    n /= 2;
  }
  return ans;
}
int main() {
  long long s, x;
  cin >> s >> x;
  if (x > s) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i <= 40; i++) mark[i] = true;
  vector<long long> xbin = bin(x);
  for (int i = 0; i <= xbin.size(); i++) mark[i] = false;
  long long power = 0;
  for (long long i = 0; i < xbin.size(); i++) {
    if (xbin[i] == 0)
      mark[i + 1] = true;
    else
      power++;
  }
  vector<long long> newbin = bin(s - x);
  bool poss = true, dec = true;
  for (long long i = 0; i < newbin.size(); i++)
    if (newbin[i] == 1)
      if (mark[i] == false) {
        cout << 0 << endl;
        return 0;
      } else {
        dec = false;
      }
  long long ans = 1;
  for (long long i = 1; i <= power; i++) ans *= 2;
  if (dec) ans -= 2;
  cout << ans << endl;
  return 0;
}
