#include <bits/stdc++.h>
using namespace std;
struct less_key {
  bool operator()(const pair<int64_t, int64_t>& p1,
                  const pair<int64_t, int64_t>& p2) {
    return p1.first < p2.first ||
           (p1.first == p2.first && p1.second > p2.second);
  }
};
struct pair_hash {
  std::size_t operator()(const pair<int64_t, int64_t>& k) const {
    return static_cast<size_t>(k.first ^ k.second);
  }
};
uint64_t x;
int64_t s;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> s >> x;
  int64_t c0 = 0;
  int64_t c1 = 0;
  uint64_t m = 1;
  while (m <= x) {
    if (x & m) {
      c1++;
      s -= m;
    } else {
      c0++;
    }
    m <<= 1;
  }
  if (s < 0) {
    cout << 0;
    return 0;
  }
  if (s % 2) {
    cout << 0;
    return 0;
  }
  m = 1;
  uint64_t S = s;
  while (m <= S) {
    if (S & m) {
      if ((x & (m >> 1)) != 0) {
        cout << 0;
        return 0;
      }
    }
    m <<= 1;
  }
  uint64_t R = 0x1ull << c1;
  if (s == 0) {
    if (R < 2) {
      cout << 0;
      return 0;
    }
    R -= 2;
  }
  cout << R;
  return 0;
}
