#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long two_ones = (a - b) >> 1LL;
  long long shift = 0;
  long long num1 = 0;
  long long num2 = 0;
  for (long long i = 0; i < 64; i++) {
    if ((b >> i) & 1LL) {
      num1 |= (1LL << i);
      shift++;
    } else if ((two_ones >> i) & 1LL) {
      num1 |= (1LL << i);
      num2 |= (1LL << i);
    }
  }
  if (num1 + num2 == a && !(two_ones & b)) {
    long long ans = 1LL << shift;
    if (num2 == 0) ans -= 2;
    cout << ans;
  } else
    cout << 0;
}
