#include <bits/stdc++.h>
using namespace std;
const int MAXN = 48;
long long s, x, xCopy, sCopy, pos[MAXN][2], result;
int n, bitS, bitX;
int main() {
  cin >> s >> x;
  pos[0][0] = 1;
  pos[0][1] = 0;
  n = 0;
  xCopy = x;
  sCopy = s;
  while (x || s) {
    n++;
    bitS = s % 2;
    bitX = x % 2;
    if (bitS == 0 && bitX == 0) {
      pos[n][0] = pos[n - 1][0];
      pos[n][1] = pos[n - 1][0];
    } else {
      if (bitS == 0 && bitX == 1) {
        pos[n][0] = 0;
        pos[n][1] = 2 * pos[n - 1][1];
      } else {
        if (bitS == 1 && bitX == 0) {
          pos[n][0] = pos[n - 1][1];
          pos[n][1] = pos[n - 1][1];
        } else {
          pos[n][0] = 2 * pos[n - 1][0];
          pos[n][1] = 0;
        }
      }
    }
    s >>= 1;
    x >>= 1;
  }
  result = pos[n][0];
  if ((sCopy ^ 0) == xCopy) result -= 2;
  cout << result;
  return 0;
}
