#include <bits/stdc++.h>
using namespace std;
const double PI = acos(0) * 2;
const double EPS = 1e-8;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcounll(s);
}
long long s, x;
long long dp[3][60];
int a[50], b[50];
int main() {
  cin >> s >> x;
  long long lx = x;
  int i = 0;
  while (x) {
    a[i] = x % 2;
    x /= 2;
    i++;
  }
  int li = i;
  i = 0;
  long long ls = s;
  while (s) {
    b[i] = s % 2;
    s /= 2;
    i++;
  }
  if (a[0] == 0) {
    if (b[0] == 0) {
      dp[1][0] = 1;
      dp[0][0] = 1;
    }
  } else {
    if (b[0] == 1) {
      dp[0][0] = 2;
    }
  }
  for (int j = 1; j <= max(i, li); j++) {
    if (a[j] == 0) {
      if (b[j] == 1) {
        dp[0][j] = dp[1][j - 1];
        dp[1][j] = dp[1][j - 1];
      } else {
        dp[1][j] = dp[0][j - 1];
        dp[0][j] = dp[0][j - 1];
      }
    } else {
      if (b[j] == 1) {
        dp[0][j] = dp[0][j - 1] * 2;
        dp[1][j] = 0;
      } else {
        dp[0][j] = 0;
        dp[1][j] = dp[1][j - 1] * 2;
      }
    }
  }
  i = max(i, li);
  long long ans = dp[0][i];
  if (ls == lx) ans -= 2;
  cout << ans;
}
