#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0), cout.precision(15);
  ll s, x;
  cin >> s >> x;
  vector<vector<ll> > dp(2, vector<ll>(40 + 1, 0));
  dp[0][40] = 1;
  for (int i = 39; i >= 0; i--) {
    for (int carry = 0; carry < 2; carry++) {
      for (int ba = 0; ba < 2; ba++) {
        for (int bb = 0; bb < 2; bb++) {
          if ((ba ^ bb) != ((x >> i) & 1)) {
            continue;
          }
          int bs = ba + bb + carry;
          if ((bs & 1) != ((s >> i) & 1)) {
            continue;
          }
          if ((bs >> 1) & 1) {
            dp[carry][i] += dp[1][i + 1];
          } else {
            dp[carry][i] += dp[0][i + 1];
          }
        }
      }
    }
  }
  ll cnt = dp[0][0];
  int zeros = 0;
  if (s == x) {
    zeros = 2;
  }
  cout << cnt - zeros << endl;
  return 0;
}
