#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1E9;
long long S, X, dp[45][2];
int dx[45], ds[45];
int main() {
  cin >> S >> X;
  bool same = S == X;
  int c = 1;
  while (S) {
    ds[c++] = S % 2;
    S /= 2;
  }
  c = 1;
  while (X) {
    dx[c++] = X % 2;
    X /= 2;
  }
  dp[0][0] = 1;
  for (int i = (1); i < (45); i++) {
    for (int c = (0); c < (2); c++) {
      if (dp[i - 1][c] == 0) continue;
      long long prev = dp[i - 1][c];
      for (int a = (0); a < (2); a++) {
        for (int b = (0); b < (2); b++) {
          if ((a + b + c) % 2 != ds[i]) continue;
          if (a ^ b != dx[i]) continue;
          int nc = (a + b + c) / 2;
          dp[i][nc] += prev;
        }
      }
    }
  }
  long long ans = dp[44][0];
  if (same) ans -= 2;
  cout << ans << endl;
  return 0;
}
