#include <bits/stdc++.h>
using namespace std;
long long a, b;
int main() {
  cin >> a >> b;
  if (a - b & 1) {
    cout << 0 << endl;
    return 0;
  }
  if (((a - b) >> 1) & b) {
    cout << 0 << endl;
    return 0;
  }
  if (a < b) {
    cout << 0 << endl;
    return 0;
  }
  cout << (1ll << __builtin_popcountll(~((a - b) >> 1ll) & b)) -
              ((a == b) ? 2ll : 0ll)
       << endl;
  return 0;
}
