#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
void solve() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long s, x;
  cin >> s >> x;
  if ((s - x) % 2 != 0 || s < x) {
    cout << "0\n";
    return 0;
  }
  long long a = (s - x) / 2;
  long long ans = 1;
  set<int> used;
  long long cur = 0;
  for (long long b = 0; (1ll << b) <= s; ++b) {
    if ((1ll << b) & a) {
      used.insert(b);
      cur += 2 * (1ll << b);
    }
  }
  long long req = s - cur;
  set<int> need;
  for (long long b = 0; (1ll << b) <= req; ++b) {
    if ((1ll << b) & req) {
      need.insert(b);
    }
  }
  for (auto x : need) {
    if (used.find(x) != used.end()) {
      cout << "0\n";
      return 0;
    }
  }
  ans = (1ll << (need.size()));
  if (s == x) ans -= 2;
  cout << ans << "\n";
  return 0;
}
