#include <bits/stdc++.h>
int s[41], x[41];
long long dp[41][4][2];
int len1, len2;
void updata(int id) {
  if (s[id] == x[id]) {
    if (s[id] == 0) {
      if (id == 0) {
        dp[id][2][0] = dp[id][3][1] = 1;
      } else {
        for (int j = 0; j < 4; ++j) {
          dp[id][2][0] += dp[id - 1][j][0];
          dp[id][3][1] += dp[id - 1][j][0];
        }
      }
    } else {
      if (id == 0) {
        dp[id][0][0] = dp[id][1][0] = 1;
      } else {
        for (int j = 0; j < 4; ++j) {
          dp[id][0][0] += dp[id - 1][j][0];
          dp[id][1][0] += dp[id - 1][j][0];
        }
      }
    }
  } else {
    if (s[id] == 0) {
      for (int j = 0; j < 4; ++j) {
        dp[id][0][1] += dp[id - 1][j][1];
        dp[id][1][1] += dp[id - 1][j][1];
      }
    } else {
      for (int j = 0; j < 4; ++j) {
        dp[id][2][0] += dp[id - 1][j][1];
        dp[id][3][1] += dp[id - 1][j][1];
      }
    }
  }
}
void every_time(int id) {
  printf("every time!: %d\n", id);
  for (int i = 0; i < 4; ++i) {
    printf("%d %d\n", dp[id][i][0], dp[id][i][1]);
  }
}
int main() {
  long long S, X;
  std::cin >> S >> X;
  if (X == 0) {
    puts("1");
    return 0;
  }
  bool same = false;
  if (S == X) same = true;
  int n = 0, m = 0;
  while (S) {
    if (S & 1)
      s[n++] = 1;
    else
      s[n++] = 0;
    S >>= 1;
  }
  while (X) {
    if (X & 1)
      x[m++] = 1;
    else
      x[m++] = 0;
    X >>= 1;
  }
  len1 = std::min(n, m);
  len2 = std::max(n, m);
  for (int i = 0; i < len2; ++i) {
    updata(i);
  }
  long long ans = 0;
  for (int i = 0; i < 4; ++i) {
    ans += dp[len2 - 1][i][0];
  }
  if (same && ans >= 2) ans -= 2;
  std::cout << ans << '\n';
  return 0;
}
