#include <bits/stdc++.h>
using namespace std;
vector<long long int> decToBinary(long long int n) {
  vector<long long int> binaryNum(64, 0);
  long long int i = 0;
  while (n > 0) {
    binaryNum[i] = n % 2;
    n = n / 2;
    i++;
  }
  return binaryNum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int s, x, a;
  cin >> s >> x;
  if ((s - x) % 2 || s < x) {
    cout << "0" << endl;
    return 0;
  }
  a = (s - x) / 2;
  vector<long long int> ad = decToBinary(a);
  vector<long long int> xo = decToBinary(x);
  reverse(ad.begin(), ad.end());
  reverse(xo.begin(), xo.end());
  long long int ans = 1, j;
  for (int i = 63; i >= 0; i--) {
    if (ad[i] == 1 || xo[i] == 1) {
      j = i;
      break;
    }
  }
  for (int i = 0; i <= j; i++) {
    if (ad[i] == 0 && xo[i] == 1) {
      ans *= 2;
    } else if (ad[i] == 1 && xo[i] == 1) {
      cout << "0" << endl;
      return 0;
    }
  }
  if (x == s) {
    ans -= 2;
  }
  cout << ans << endl;
}
