#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, m;
  cin >> n >> m;
  if ((n - m) % 2 == 1 || m > n) {
    cout << 0 << endl;
    return 0;
  }
  long long ad = (n - m) / 2;
  long long oo = n - (n - m) / 2;
  long long res = oo - ad;
  long long resp = 1;
  if (ad == oo) {
    cout << 1 << endl;
    return 0;
  }
  while (res > 0) {
    resp *= 2;
    res -= (res & -res);
  }
  if ((ad & m) != 0) {
    cout << 0 << endl;
    return 0;
  }
  if (ad == 0) resp -= 2;
  if (resp == 1)
    cout << 0 << endl;
  else
    cout << resp << endl;
}
