#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int inf = 1e9;
const int mod = 1e9 + 7;
int n;
long long dp[maxn][2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long s, x;
  cin >> s >> x;
  dp[50][0] = 1;
  for (long long i = 49; i >= 0; i--) {
    if (x & (1ll << i)) {
      if (s & (1ll << i)) {
        dp[i][0] = 2 * dp[i + 1][0];
      } else
        dp[i][1] = 2 * dp[i + 1][1];
    } else {
      if (s & (1ll << i)) {
        dp[i][1] = dp[i + 1][1] + dp[i + 1][0];
      } else {
        dp[i][0] = dp[i + 1][1] + dp[i + 1][0];
      }
    }
  }
  if (x == s) dp[0][0] -= 2;
  cout << dp[0][0] << endl;
}
