#include <bits/stdc++.h>
using namespace std;
long long d[50][2] = {};
long long ss, xx;
int s[50], x[50];
int main() {
  cin >> ss >> xx;
  bool eq = ss == xx;
  for (int i = 0; i < (int)(50); ++i) {
    s[i] = ss & 1;
    ss >>= 1;
    x[i] = xx & 1;
    xx >>= 1;
  }
  d[0][0] = 1;
  for (int i = 0; i < (int)(49); ++i)
    for (int j = 0; j < (int)(2); ++j) {
      for (int a = 0; a < (int)(2); ++a)
        for (int b = 0; b < (int)(2); ++b) {
          if ((a + b + j) % 2 != s[i]) continue;
          if ((a ^ b) != x[i]) continue;
          d[i + 1][(a + b + j) / 2] += d[i][j];
        }
    }
  if (eq) d[49][0] -= 2;
  cout << d[49][0] << endl;
  return 0;
}
