#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long add(long long x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
long long mul(long long x, long long y) { return (x * y) % mod; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long x, s;
  cin >> s >> x;
  long long ret = 0;
  if (s == x) ret = -2;
  long long ans = 1;
  for (int i = 0; i <= 40; i++) {
    if (x & (1LL << (i))) {
      ans *= 2;
      if (s < (1LL << (i))) {
        cout << 0 << endl;
        exit(0);
      };
      s -= (1LL << (i));
    }
  }
  for (int i = 0; i <= 40; i++) {
    if (!(x & (1LL << (i)))) {
      if (s & (1LL << (i + 1))) {
        s -= (1LL << (i + 1));
      }
    }
  }
  if (s != 0) {
    cout << 0 << endl;
    exit(0);
  };
  cout << ans + ret << endl;
  return 0;
}
