#include <bits/stdc++.h>
using namespace std;
const int module = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long s, x;
  cin >> s >> x;
  const int N = 45;
  vector<bool> S(N, 0), X(N, 0);
  for (int i = 0; i < N; ++i) {
    S[i] = s & (1LL << i);
    X[i] = x & (1LL << i);
  }
  vector<long long> dp1(N, 0), dp2(N, 0);
  dp1[0] = 1;
  for (int i = 0; i < N - 1; ++i) {
    if (!S[i] && !X[i]) {
      dp1[i + 1] += dp1[i];
      dp2[i + 1] += dp1[i];
    }
    if (S[i] && X[i]) {
      dp1[i + 1] += 2 * dp1[i];
    }
    if (!S[i] && X[i]) {
      dp2[i + 1] += 2 * dp2[i];
    }
    if (S[i] && !X[i]) {
      dp1[i + 1] += dp2[i];
      dp2[i + 1] += dp2[i];
    }
  }
  cout << dp1[N - 1] - (x == s ? 2 : 0) << "\n";
  return 0;
}
