#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  long long s, x, fl = 0, sum[50] = {0}, xo[50] = {0}, s1, x1, f = 0;
  cin >> s >> x;
  s1 = s;
  x1 = x;
  for (long long i = 0; i < 49; ++i) {
    if (s1 % 2) sum[i] = 1;
    if (x1 % 2) xo[i] = 1;
    s1 /= 2;
    x1 /= 2;
  }
  for (long long i = 1; i < 49; ++i) {
    if ((sum[i - 1] == 1 && xo[i - 1] == 1 && sum[i] != xo[i]) ||
        (sum[i] == xo[i] && xo[i - 1] == 1 && sum[i - 1] == 0)) {
      f = 1;
      break;
    }
  }
  if (x > s || ((s % 2) != (x % 2)) || f) {
    cout << "0";
    return 0;
  }
  long long cn = 0;
  if (s == x) fl = 1;
  while (x) {
    if (x % 2 == 1) cn++;
    x /= 2;
  }
  long long an = pow(2, cn);
  if (fl)
    cout << an - 2;
  else
    cout << an;
  return 0;
}
