#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  while (cin >> s >> x) {
    long long dp[41][2];
    memset(dp, 0, sizeof dp);
    dp[0][0] = 1;
    for (int i = 0; i < 40; i++) {
      if (x & (1LL << i)) {
        if (s & (1LL << i)) dp[i + 1][0] += 2 * dp[i][0];
        if (!(s & (1LL << i))) dp[i + 1][1] += 2 * dp[i][1];
      } else {
        if (!(s & (1LL << i)))
          dp[i + 1][0] += dp[i][0], dp[i + 1][1] += dp[i][0];
        if (s & (1LL << i)) dp[i + 1][0] += dp[i][1], dp[i + 1][1] += dp[i][1];
      }
    }
    cout << dp[40][0] - 2 * (s == x) << endl;
  }
  return 0;
}
