#include <bits/stdc++.h>
long long s, x;
int sba[150], xba[150];
long long bab[150];
int main(int argc, char** argv) {
  int i, j;
  int num;
  int n, m;
  int flag;
  long long tmp;
  long long ans;
  bab[0] = 1;
  for (i = 1; i < 60; i++) bab[i] = bab[i - 1] * 2;
  while (~scanf("%I64d%I64d", &s, &x)) {
    if (s < x) {
      printf("0\n");
      continue;
    }
    memset(sba, 0, sizeof(sba));
    memset(xba, 0, sizeof(xba));
    i = 0;
    num = 0;
    tmp = x;
    while (tmp) {
      if (tmp & 1) {
        num++;
        xba[i] = 1;
      }
      tmp >>= 1;
      i++;
    }
    n = i;
    ans = 0;
    ans += bab[num];
    tmp = s - x;
    if (tmp & 1) {
      printf("0\n");
      continue;
    }
    flag = 0;
    i = 0;
    while (tmp) {
      if (tmp & 1) {
        sba[i] = 1;
      }
      tmp >>= 1;
      i++;
    }
    m = i;
    for (i = 0; i < n; i++) {
      if (xba[i] == 1 && sba[i + 1] == 1) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      printf("0\n");
      continue;
    } else {
      if ((s ^ 0) == x) ans -= 2;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
