#include <bits/stdc++.h>
using namespace std;
long long s, x;
long long dfs(long long now, long long s) {
  if (now < 0) return 0;
  if (now == 0) {
    if (s == 0) return 1;
    return 0;
  }
  if (s & 1) {
    if (now & 1) return 2 * dfs(now / 2, s / 2);
    return 0;
  } else {
    if (now & 1) return 0;
    return dfs(now / 2 - 1, s / 2) + dfs(now / 2, s / 2);
  }
}
int main() {
  scanf("%lld%lld", &s, &x);
  if (s == x)
    printf("%lld", dfs(s, x) - 2);
  else
    printf("%lld", dfs(s, x));
  return 0;
}
