#include <bits/stdc++.h>
using namespace std;
long long a, b, sol;
int main() {
  sol = 1;
  scanf("%lld%lld", &a, &b);
  sol *= ((1LL) << __builtin_popcountll(b));
  if (((a - b) & 1) || (((a - b) >> 1) & b)) {
    puts("0");
    return 0;
  }
  if (a == b) sol -= 2;
  if (!(a & 1) && !b) {
    puts("1");
    return 0;
  }
  cout << sol;
  return 0;
}
