#include <bits/stdc++.h>
using namespace std;
long long int binpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a);
    a = (a * a);
    b >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int j, i, n, t, l, c, h, k, da, m, maxi, d, s, x;
  cin >> s >> x;
  long long int a = (s - x) / 2;
  if (a < 0 || (s - x) % 2 != 0) {
    cout << 0 << endl;
  } else {
    string s = "", w = "";
    while (x != 0 || a != 0) {
      c = x % 2;
      d = a % 2;
      if (c == 1)
        s = "1" + s;
      else
        s = "0" + s;
      if (d == 1)
        w = "1" + w;
      else
        w = "0" + w;
      x = x / 2;
      a = a / 2;
    }
    long long int ans = 1;
    k = 0;
    map<long long int, long long int> m;
    long long int z = 2;
    for (j = 0; j < s.length(); j++) {
      if (s[j] == '1' && w[j] == '1') {
        k = -1;
        break;
      } else if (s[j] == '1' && w[j] == '0') {
        ans = ans * 2;
      } else if (s[j] == '0' && w[j] == '1') {
        ans = ans;
        z = 0;
      } else {
        ans = ans;
      }
    }
    if (k == -1)
      cout << 0;
    else
      cout << ans - z;
  }
}
