#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
long long s, x, y;
int main() {
  read_file();
  while (scanf("%lld%lld\n", &s, &x) != EOF) {
    if (s - x >= 0 && (s - x) % 2 == 0)
      ;
    else {
      printf("0\n");
      continue;
    }
    y = s - x;
    y /= 2;
    long long ans = 0;
    for (int i = 0; i < 62; i++) {
      if ((x & (1LL << i)) == 0) continue;
      if ((y & (1LL << i)) != 0) {
        ans = -1;
        break;
      }
      ans++;
    }
    if (ans == -1)
      ans = 0;
    else {
      ans = 1LL << ans;
      if (y == 0) ans -= 2;
    }
    printf("%lld\n", ans);
  }
}
