#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long sum, cor, x;
  cin >> sum >> x;
  if (sum < x)
    cout << "0";
  else if (x == 0 && sum != 0)
    cout << "1";
  else {
    long long a = (sum - x) / 2, ans = 1;
    if (a < 0 || x + 2 * a != sum || (x & a) != 0) {
      cout << 0 << endl;
      return 0;
    }
    long long tmp = x;
    while (tmp > 0) {
      if (tmp & 1) ans = ans * 2;
      tmp >>= 1;
    }
    if (a == 0) ans -= 2;
    cout << ans << endl;
  }
}
