#include <bits/stdc++.h>
using namespace std;
long long S, X;
long long dp[41][2];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> S >> X;
  dp[0][0] = 1;
  for (int i = 0; i < (40); i++) {
    for (int k = 0; k < (2); k++) {
      for (int a = 0; a < (2); a++) {
        for (int b = 0; b < (2); b++) {
          int r = a ^ b ^ k;
          int nk = (a + b + k >= 2);
          if (((S & (1LL << i)) != 0) != r) continue;
          if (((X & (1LL << i)) != 0) != (a ^ b)) continue;
          dp[i + 1][nk] += dp[i][k];
        }
      }
    }
  }
  long long s = dp[40][0];
  if (S == X) s -= 2;
  cout << s << "\n";
  return 0;
}
