#include <bits/stdc++.h>
using namespace std;
string getbiner(long long n) {
  string ret = "";
  while (n) {
    if (n % 2)
      ret += '1';
    else
      ret += '0';
    n /= 2;
  }
  return ret;
}
long long getnum(string s) {
  long long ret = 0;
  long long now = 1;
  cout << "\t" << ("s") << " = " << (s) << "\n";
  for (long long(i) = (0); (i) < (s.length()); (i)++) {
    ret += ((s[i] - '0') * now);
    now *= 2;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  if (n < m) {
    cout << 0 << "\n";
    return 0;
  }
  if ((n - m) % 2) {
    cout << 0 << "\n";
    return 0;
  }
  long long k = (n - m) / 2;
  string a = getbiner(m);
  string b = getbiner(k);
  long long mx = max(a.length(), b.length());
  long long diffa = mx - a.length();
  long long diffb = mx - b.length();
  for (long long(i) = (0); (i) < (diffa); (i)++) a += '0';
  for (long long(i) = (0); (i) < (diffb); (i)++) b += '0';
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  long long counter = 0;
  int flag = 0;
  for (long long(i) = (0); (i) < (a.length()); (i)++) {
    if (a[i] == '1' && b[i] == '0') {
      counter++;
    } else if (a[i] == '1' && b[i] == '1') {
      flag = 1;
    }
  }
  if (flag) {
    cout << 0 << "\n";
    return 0;
  }
  long long ans = pow(2, counter);
  if (n == m) ans -= 2;
  cout << ans << "\n";
}
