#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
const int M = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long s, x;
  cin >> s >> x;
  int count = 1;
  long long dp[60][2];
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  bool ok = s == x;
  while (s or x) {
    bool a = s & 1, b = x & 1;
    s >>= 1;
    x >>= 1;
    if (b == false) {
      if (a == false) {
        dp[count][0] = dp[count - 1][0];
        dp[count][1] = dp[count - 1][0];
      } else {
        dp[count][0] = dp[count - 1][1];
        dp[count][1] = dp[count - 1][1];
      }
    } else {
      if (a == false) {
        dp[count][1] = 2 * dp[count - 1][1];
      } else {
        dp[count][0] = 2 * dp[count - 1][0];
      }
    }
    count++;
  }
  if (ok) dp[count - 1][0] -= 2;
  cout << dp[count - 1][0];
}
