#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    long long int s, x;
    cin >> s >> x;
    if (s % 2 != x % 2 || s < x) {
      cout << 0 << endl;
      return 0;
    }
    long long int temp = (s - x) / 2;
    bitset<50> andwala(temp);
    bitset<50> xorwala(x);
    long long int ans = 0;
    bool flag = true;
    for (int i = 0; i < 50; i++) {
      if (xorwala[i] == 1 and andwala[i] == 1) {
        flag = false;
        break;
      } else if (xorwala[i] == 1) {
        ans++;
      }
    }
    if (!flag) {
      cout << 0 << endl;
      return 0;
    }
    if (s != x) {
      ans = pow(2, ans);
      cout << ans << endl;
      return 0;
    }
    ans = pow(2, ans);
    ans -= 2;
    cout << ans << endl;
  }
  return 0;
}
