#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const long long mod = 1000000007;
long long dp[55][2];
void solve() {
  long long s, x;
  cin >> s >> x;
  dp[0][0] = 1;
  for (int i = 0; i < 54; i++) {
    for (int j = 0; j < 2; j++) {
      if (dp[i][j] == 0) continue;
      long long b1 = ((1LL << (i)) & s), b2 = ((1LL << (i)) & x);
      if (b1 > 0) b1 = 1;
      if (b2 > 0) b2 = 1;
      for (int x = 0; x < 2; x++) {
        for (int y = 0; y < 2; y++) {
          int s1 = 0, c1 = 0;
          s1 = (x + y + j) % 2;
          if (x + y + j > 1) c1 = 1;
          int x1 = x ^ y;
          if (x1 == b2 && s1 == b1) dp[i + 1][c1] += dp[i][j];
        }
      }
    }
  }
  if (s == x) dp[54][0] -= 2;
  cout << dp[54][0];
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
  return 0;
}
