#include <bits/stdc++.h>
using namespace std;
long long dp[100][3], ma, s, x;
long long rec(long long n, long long carry) {
  if (n == ma && carry == 0) return 1;
  if (n == ma && carry == 1) return 0;
  if (dp[n][carry] != -1) return dp[n][carry];
  long long ans;
  if ((x & ((long long)1 << n))) {
    if (carry == 0) {
      if (!(s & ((long long)1 << n)))
        ans = 0;
      else
        ans = 2 * rec(n + 1, 0);
    } else {
      if ((s & ((long long)1 << n)))
        ans = 0;
      else {
        ans = 2 * rec(n + 1, 1);
      }
    }
  } else {
    if (carry == 0) {
      if ((s & ((long long)1 << n)))
        ans = 0;
      else
        ans = rec(n + 1, 1) + rec(n + 1, 0);
    } else {
      if (!(s & ((long long)1 << n)))
        ans = 0;
      else {
        ans = rec(n + 1, 1) + rec(n + 1, 0);
      }
    }
  }
  return (dp[n][carry] = ans);
}
int main() {
  cin >> s >> x;
  long long ss = s;
  long long xx = x, cnt = 0, cnt1 = 0;
  while (ss > 0) {
    ss = ss / 2;
    cnt++;
  }
  while (xx > 0) {
    xx = xx / 2;
    cnt1++;
  }
  ma = max(cnt1, cnt);
  memset(dp, -1, sizeof(dp));
  long long vv;
  if (s == x)
    vv = 2;
  else
    vv = 0;
  cout << rec(0, 0) - vv;
}
