#include <bits/stdc++.h>
using namespace std;
long long po(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % 1000000007;
    }
    a = (a * a) % 1000000007;
    b = b / 2;
  }
  return res % 1000000007;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  {
    long long s, x;
    cin >> s >> x;
    long long a = (s - x) / 2;
    if (a < 0 || (x & a) != 0 || (2 * a + x) != s) {
      cout << 0 << "\n";
    } else {
      long long bits = 0, temp = x;
      while (temp) {
        bits += temp & 1;
        temp >>= 1;
      }
      long long ans = 1ll << bits;
      if (a == 0) ans -= 2;
      cout << ans << "\n";
    }
  }
}
