#include <bits/stdc++.h>
using namespace std;
const int N = 50;
long long s, x;
long long dp[N + 5][2][2][2];
long long S[N + 5], X[N + 5];
long long f(int i, int a, int b, int r) {
  if (dp[i][a][b][r] != -1) return dp[i][a][b][r];
  if (X[i] == 0 and a != b) return dp[i][a][b][r] = 0;
  if (X[i] == 1 and a == b) return dp[i][a][b][r] = 0;
  if ((a + b + r) % 2 != S[i]) return dp[i][a][b][r] = 0;
  int res = (a + b + r) / 2;
  if (i >= N) {
    if (res == 0) {
      return dp[i][a][b][r] = 1;
    } else
      return dp[i][a][b][r] = 0;
  }
  return dp[i][a][b][r] = f(i + 1, 0, 0, res) + f(i + 1, 0, 1, res) +
                          f(i + 1, 1, 0, res) + f(i + 1, 1, 1, res);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  while (cin >> s >> x) {
    memset(S, 0, sizeof(S));
    memset(X, 0, sizeof(X));
    memset(dp, -1, sizeof(dp));
    int i = 0;
    long long res = 0;
    if (x == s) res = -2;
    while (s > 0) {
      S[i] = s % 2LL;
      s /= 2LL;
      i++;
    }
    i = 0;
    while (x > 0) {
      X[i] = x % 2LL;
      x /= 2LL;
      i++;
    }
    res += f(0, 0, 0, 0) + f(0, 0, 1, 0) + f(0, 1, 0, 0) + f(0, 1, 1, 0);
    cout << res << endl;
  }
  return 0;
}
