#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, i, s, x, cnt = 1;
  cin >> s >> x;
  if (s < x) {
    cout << 0;
    return 0;
  }
  long long gap = s - x;
  for (i = 40; i >= 0; i--) {
    if (((x >> i) & 1))
      cnt *= 2;
    else if ((1ll << (i + 1)) <= gap)
      gap -= (1ll << (i + 1));
  }
  if (gap)
    cout << "0";
  else if (s == x)
    cout << cnt - 2;
  else
    cout << cnt;
}
