#include <bits/stdc++.h>
int ss[70] = {0};
int xx[70] = {0};
long long dfs(int id, int flag) {
  if (id == 60 && flag == 0) return 1;
  if (id == 60) return 0;
  if (ss[id] == 1 && xx[id] == 1 && flag == 1) {
    return 0;
  } else if (ss[id] == 1 && xx[id] == 1 && flag == 0) {
    return dfs(id + 1, 0) * 2;
  } else if (ss[id] == 1 && xx[id] == 0 && flag == 1) {
    return dfs(id + 1, 0) + dfs(id + 1, 1);
  } else if (ss[id] == 1 && xx[id] == 0 && flag == 0) {
    return 0;
  } else if (ss[id] == 0 && xx[id] == 1 && flag == 1) {
    return dfs(id + 1, 1) * 2;
  } else if (ss[id] == 0 && xx[id] == 1 && flag == 0) {
    return 0;
  } else if (ss[id] == 0 && xx[id] == 0 && flag == 1) {
    return 0;
  } else if (ss[id] == 0 && xx[id] == 0 && flag == 0) {
    return dfs(id + 1, 1) + dfs(id + 1, 0);
  }
}
int main() {
  long long s, x, res = 0;
  scanf("%lld %lld", &s, &x);
  if (s == x) res -= 2;
  int id = 0;
  while (s) {
    if (s % 2 == 1) ss[id] = 1;
    s /= 2;
    id++;
  }
  id = 0;
  while (x) {
    if (x % 2 == 1) {
      xx[id] = 1;
    }
    x /= 2;
    id++;
  }
  res += dfs(0, 0);
  printf("%lld", res);
  return 0;
}
