#include <bits/stdc++.h>
using namespace std;
inline std::vector<size_t> RepresentInBaseTwo(unsigned long long num) {
  std::vector<size_t> ans;
  while (num) {
    ans.push_back(num & 1);
    num >>= 1;
  }
  return ans;
}
pair<unsigned long long, unsigned long long> find(size_t sum, size_t xo,
                                                  size_t plus) {
  pair<unsigned long long, unsigned long long> ans;
  ans = make_pair(0, 0);
  for (size_t i = 0; i < 2; i++) {
    for (size_t j = 0; j < 2; j++) {
      size_t t = i ^ j;
      if ((i + j + plus) % 2 == sum % 2 && t == xo) {
        if (i + j + plus > 1) {
          ++ans.second;
        } else {
          ++ans.first;
        }
      }
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(7);
  unsigned long long s, x;
  std::cin >> s >> x;
  auto ss = RepresentInBaseTwo(s);
  auto xx = RepresentInBaseTwo(x);
  int num = 50;
  ss.insert(ss.end(), num - ss.size(), 0);
  xx.insert(xx.end(), num - xx.size(), 0);
  std::vector<unsigned long long> a{1, 0};
  for (size_t step = 0; step < num; ++step) {
    std::vector<unsigned long long> b{0, 0};
    for (size_t k = 0; k < 2; k++) {
      for (size_t i = 0; i < 2; i++) {
        for (size_t j = 0; j < 2; j++) {
          size_t t = i ^ j;
          if ((i + j + k) % 2 == ss[step] % 2 && t == xx[step]) {
            if (i + j + k > 1) {
              b[1] += a[k];
            } else {
              b[0] += a[k];
            }
          }
        }
      }
    }
    a = b;
  }
  std::cout << a[0] - (s == x ? 2 : 0) << std::endl;
  return 0;
}
