#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int s, x;
  cin >> s >> x;
  long long int x1 = (s - x);
  if ((x1 % 2) || (x > s) || x + x1 != s) {
    cout << 0 << endl;
    return 0;
  }
  x1 /= 2;
  if ((x1 & x) != 0) {
    cout << 0 << endl;
    return 0;
  }
  long long int cnt = 0;
  for (long long int i = 62; i >= 0; i--) {
    if ((x >> i) & 1ll) cnt++;
  }
  long long int ans = 1ll << cnt;
  if (x1 == 0) {
    cout << ans - 2 << endl;
  } else
    cout << ans << endl;
  return 0;
}
