#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int n, m, i, j, k, p, ans1 = 0, ans2 = 0;
  cin >> n >> m;
  if (n == m) ans2++;
  p = (n - m);
  if (p < 0 || p % 2 || (p / 2 & m)) {
    cout << 0 << "\n";
    exit(0);
  } else {
    while (m > 0) {
      ans1 += (m % 2);
      m = m / 2;
    }
    ans1 = (1LL << ans1);
  }
  if (ans2) ans1 -= 2;
  cout << ans1 << "\n";
  return 0;
}
