#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s, x;
  cin >> s >> x;
  long long temp = (s - x) / 2;
  long long ans = 1;
  if (temp * 2 != s - x) {
    cout << 0 << endl;
    return 0;
  } else {
    for (int i = 0; i < 60; i++) {
      int p1 = (temp >> i) & 1;
      int p2 = (x >> i) & 1;
      if (p1 == 1 && p2 == 1) {
        cout << 0 << endl;
        return 0;
      }
      if (p2 == 1) ans *= 2;
    }
    if (s == x)
      cout << ans - 2 << endl;
    else
      cout << ans << endl;
  }
  return 0;
}
