#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  if ((n - m) % 2) {
    cout << 0 << '\n';
    return;
  }
  long long dif = (n - m) / 2;
  long long ans = 1;
  for (long long i = 50; i >= 0; i--) {
    if (m & (1LL << i)) ans *= 2;
    if (dif & (1ll << i)) {
      if (m & (1ll << i)) {
        cout << 0 << '\n';
        return;
      }
    }
  }
  if (n == m) ans -= 2;
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
