#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long s, x;
  cin >> s >> x;
  s -= x;
  if (s % 2 || s < 0) {
    cout << 0 << '\n';
    return 0;
  }
  s >>= 1;
  bool ok = true;
  for (int i = 50; i >= 0; --i)
    if (s & (1LL << i)) ok &= (~x & (1LL << i)) != 0;
  if (!ok) {
    cout << 0 << '\n';
    return 0;
  }
  long long ans = 1LL << __builtin_popcountll(x);
  cout << (s == 0 ? ans - 2 : ans) << '\n';
}
