#include <bits/stdc++.h>
using namespace std;
const int N = 1111;
int64_t x, s;
int res;
int64_t ans = 0;
void rec(int ind, int c, int64_t sum) {
  if (ind == 45 && c == 0) {
    ans += sum;
    return;
  }
  int64_t a = (x & (1ll << ind)) > 0;
  int64_t b = (s & (1ll << ind)) > 0;
  if (c != 0) b = (b + 1) % 2;
  if (a == 0 && b == 0) {
    rec(ind + 1, 0, sum);
    rec(ind + 1, 1, sum);
  }
  if (a == 1 && b == 1) {
    rec(ind + 1, c, sum * 2);
  }
}
int naive() {
  int ans = 0;
  for (int i = 1; i < s; i++) {
    if ((i ^ (s - i)) == x) ans++;
  }
  return ans;
}
int main() {
  cin >> s >> x;
  rec(0, 0, 1);
  if (s == x) ans -= 2;
  cout << ans;
  return 0;
}
