#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long n, long long temp) {
  long long res = 1, y = a;
  while (n > 0) {
    if (n & 1) res = (res * y) % temp;
    y = (y * y) % temp;
    n /= 2;
  }
  return res % temp;
}
long long ison(long long mask, long long pos) { return (mask & (1 << pos)); }
long long cbit(long long n) {
  long long k = 0;
  while (n) n &= (n - 1), k++;
  return k;
}
long long nbit(long long n) {
  long long k = 0;
  while (n) n /= 2, k++;
  return k;
}
long long mod = 1e9 + 7;
int sgn(long long x) { return x < 0 ? -1 : !!x; }
long long a[200005], b[200005];
long long bit[400005], n, bit2[40005];
void upd(long long ind, long long val) {
  if (ind == 0) return;
  while (ind <= n) {
    bit[ind] += val;
    ind += (ind & -ind);
  }
}
long long qu(long long ind) {
  long long k = 0;
  while (ind > 0) {
    k += bit[ind];
    ind -= (ind & -ind);
  }
  return k;
}
void upd2(long long ind, long long val) {
  if (ind == 0) return;
  while (ind <= n) {
    bit2[ind] += val;
    ind += (ind & -ind);
  }
}
long long qu2(long long ind) {
  long long k = 0;
  while (ind > 0) {
    k += bit2[ind];
    ind -= (ind & -ind);
  }
  return k;
}
long long xo(long long i) {
  if ((i & 3) == 0) return i;
  if ((i & 3) == 1) return 1;
  if ((i & 3) == 2) return i + 1;
  return 0;
}
int main() {
  long long s, x, i, j, k, l;
  cin >> s >> x;
  long long a = (s - x) / 2;
  if (a < 0 || 2 * a + x != s || (x & a) != 0)
    cout << 0;
  else {
    long long bit = 0;
    long long t = x;
    while (t) {
      if (t & 1) bit++;
      t >>= 1;
    }
    long long ans = (1ll << bit);
    if (!a) ans -= 2;
    cout << ans;
  }
}
