#include <bits/stdc++.h>
using namespace std;
long long s, first;
long long dp[50][2];
long long rec(long long in, long long carry) {
  if (in >= 44) {
    carry = carry ^ 1ll;
    return carry;
  }
  if (dp[in][carry] != -1) return dp[in][carry];
  long long sbit = (s >> in);
  sbit = sbit & 1LL;
  long long xbit = (first >> in);
  xbit = xbit & 1LL;
  long long ans = 0;
  for (int ca = 0; ca <= 1; ca++) {
    for (int cb = 0; cb <= 1; cb++) {
      long long ncarry = 0, nsum = 0, nxor = 0;
      nxor = (ca ^ cb);
      nsum = (ca + cb + carry);
      if (nsum >= 2LL) {
        nsum -= 2LL;
        ncarry = 1;
      }
      if (nxor == xbit && nsum == sbit) ans += rec(in + 1LL, ncarry);
    }
  }
  dp[in][carry] = ans;
  return dp[in][carry];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> s >> first;
  memset(dp, -1, sizeof(dp));
  long long dec = 0;
  if (s == first) dec = 2LL;
  cout << rec(0, 0) - dec;
  return 0;
}
