#include <bits/stdc++.h>
using namespace std;
long long s, x;
int main() {
  cin >> s >> x;
  s -= x;
  if (s < 0 || s % 2 != 0) {
    cout << 0 << endl;
    return 0;
  }
  s /= 2;
  if (s & x) {
    cout << 0 << endl;
    return 0;
  }
  long long bit = 0, result = 0;
  if (!s) result -= 2;
  while (x > 0) {
    bit += x & 1;
    x >>= 1;
  }
  result += 1LL << bit;
  cout << result << endl;
  return 0;
}
