#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double E = 1e-11;
template <typename T>
inline T sqr(T t) {
  return t * t;
}
const int MM = 100;
bool to[MM][MM];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.precision(12);
  cout << fixed;
  srand(time(NULL));
  long long n, m;
  cin >> m >> n;
  long long dp[42][2];
  memset(dp, 0, sizeof(dp));
  if ((n & 1) != (m & 1)) {
    cout << 0;
    return 0;
  }
  n <<= 1, m <<= 1;
  dp[0][0] = 1;
  for (int i = 1; i < 42; i++) {
    for (int j = 0; j < 2; j++) {
      for (int x = 0; x < 2; x++) {
        for (int y = 0; y < 2; y++) {
          long long sum = (x + y + j);
          long long xxxor = (x ^ y);
          if ((sum & 1) == (bool)((m & (1LL << i))) &&
              xxxor == (bool)(n & (1LL << i))) {
            dp[i][sum / 2] += dp[i - 1][j];
          }
        }
      }
    }
  }
  cout << dp[41][0] + (n == m ? -2 : 0) << "\n";
}
