#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
}
long long mulmod(long long a, long long b, long long m) {
  long long q = (long long)(((long double)a * (long double)b) / (long double)m);
  long long r = a * b - q * m;
  if (r > m) r %= m;
  if (r < 0) r += m;
  return r;
}
template <typename T>
T mod(T a, T b) {
  while (a < 0) a += b;
  return a % b;
}
template <typename T>
T power(T e, T n, T m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mod(x * p, m);
    p = mod(p * p, m);
    n >>= 1;
  }
  return x;
}
template <typename T>
T power(T e, T n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T InverseEuler(T a, T m) {
  return (a == 1 ? 1 : power(a, m - 2, m));
}
template <typename T>
T gcd(T a, T b) {
  return (!b) ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return (a * (b / gcd(a, b)));
}
int exEuler(int a, int b, int &x, int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  int x1, y1;
  int g = exEuler(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return g;
}
long long s, x;
int ss[40], xx[40];
long long ans[40];
int main(int argc, char *argv[]) {
  io();
  cin >> s >> x;
  int j = 0;
  long long ts = s, tx = x;
  while (ts) {
    ss[j++] = ts & 1;
    ts >>= 1;
  }
  int l = j;
  j = 0;
  while (tx) {
    xx[j++] = tx & 1;
    tx >>= 1;
  }
  l = max(l, j);
  if (ss[0] ^ xx[0] == 1) {
    cout << 0 << '\n';
    return 0;
  }
  ans[0] = 2;
  bool f = 1;
  for (__typeof(l - 1) i = 1; i <= l - 1; ++i) {
    if (i != l - 1) {
      if (ss[i] == 0 && xx[i] == 0) {
        if (ss[i - 1] == 0 && xx[i - 1] == 0) {
          ans[i] = ans[i - 1];
        } else if (ss[i - 1] == 0 && xx[i - 1] == 1) {
          f = 0;
          break;
        } else if (ss[i - 1] == 1 && xx[i - 1] == 0) {
          ans[i] = ans[i - 1];
        } else {
          ans[i] = ans[i - 1] * 2;
        }
      } else if (ss[i] == 0 && xx[i] == 1) {
        if (ss[i - 1] == 1 && xx[i - 1] == 1) {
          f = 0;
          break;
        } else if ((ss[i - 1] == 1 && xx[i - 1] == 0) ||
                   (ss[i - 1] == 0 && xx[i - 1] == 0)) {
          ans[i] = ans[i - 1];
        } else {
          ans[i] = ans[i - 1] * 2;
        }
      } else if (ss[i] == 1 && xx[i] == 0) {
        if (ss[i - 1] == 1 && xx[i - 1] == 1) {
          f = 0;
          break;
        } else if ((ss[i - 1] == 1 && xx[i - 1] == 0) ||
                   (ss[i - 1] == 0 && xx[i - 1] == 0)) {
          ans[i] = ans[i - 1];
        } else {
          ans[i] = ans[i - 1] * 2;
        }
      } else {
        if (xx[i - 1] == 0) {
          ans[i] = ans[i - 1];
        } else if (ss[i - 1] == 0) {
          f = 0;
          break;
        } else {
          ans[i] = ans[i - 1] * 2;
        }
      }
    }
    if (i == l - 1) {
      if (ss[i] == 0 && xx[i] == 0) {
        if (ss[i - 1] == 0 && xx[i - 1] == 0) {
          ans[i] = ans[i - 1];
        } else if (ss[i - 1] == 0 && xx[i - 1] == 1) {
          f = 0;
          break;
        } else if (ss[i - 1] == 1 && xx[i - 1] == 0) {
          ans[i] = ans[i - 1];
        } else {
          ans[i] = ans[i - 1] * 2;
        }
      } else if (ss[i] == 0 && xx[i] == 1) {
        f = 0;
        break;
      } else if (ss[i] == 1 && xx[i] == 0) {
        if (ss[i - 1] == 1 && xx[i - 1] == 1) {
          f = 0;
          break;
        } else if ((ss[i - 1] == 1 && xx[i - 1] == 0) ||
                   (ss[i - 1] == 0 && xx[i - 1] == 0)) {
          ans[i] = ans[i - 1] / 2;
        } else {
          ans[i] = ans[i - 1];
        }
      } else {
        if (xx[i - 1] == 0) {
          ans[i] = ans[i - 1];
        } else if (ss[i - 1] == 0) {
          f = 0;
          break;
        } else {
          ans[i] = ans[i - 1] * 2;
        }
      }
    }
  }
  if (f == 0) {
    cout << 0 << '\n';
  } else {
    if (s == x) ans[l - 1] -= 2;
    cout << (ans[l - 1]) << '\n';
  }
  return 0;
}
