#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  if ((a - b) % 2 != 0 || ((a - b) / 2) & b)
    cout << "0\n";
  else {
    if ((a - b) / 2)
      cout << ((long long)1 << __builtin_popcountll(b)) << "\n";
    else
      cout << ((long long)1 << __builtin_popcountll(b)) - 2 << "\n";
  }
}
