#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t s, x;
  cin >> s >> x;
  int64_t dp[50][2]{};
  dp[0][0] = 1;
  for (int i = 0; i < 45; i++) {
    bool sbit = (s >> i) & 1, xbit = (x >> i) & 1;
    if (sbit) {
      if (xbit) {
        dp[i + 1][0] += 2 * dp[i][0];
      } else {
        dp[i + 1][0] += dp[i][1];
        dp[i + 1][1] += dp[i][1];
      }
    } else {
      if (xbit) {
        dp[i + 1][1] += 2 * dp[i][1];
      } else {
        dp[i + 1][1] += dp[i][0];
        dp[i + 1][0] += dp[i][0];
      }
    }
  }
  cout << dp[45][0] - (s == x) * 2 << "\n";
  return 0;
}
