#include <bits/stdc++.h>
using namespace std;
const int MAXL = 60;
long long dp[MAXL][2];
string toBin(long long x) {
  if (x == 0) return "0";
  string s = "";
  while (x) {
    s += x % 2 + '0';
    x /= 2;
  }
  reverse(s.begin(), s.end());
  return s;
}
int main() {
  long long sn, xn;
  cin >> sn >> xn;
  string s = toBin(sn);
  string x = toBin(xn);
  if (s.length() < x.length()) {
    cout << 0 << endl;
    return 0;
  }
  s = "0" + s;
  string addToX = "";
  for (int i = 0; i < (int)s.length() - (int)x.length(); i++) addToX += "0";
  x = addToX + x;
  dp[0][s[0] - '0'] = 1;
  for (int i = 1; i < s.length(); i++)
    for (int j = 0; j < 2; j++) {
      for (int a = 0; a < 2; a++)
        for (int b = 0; b < 2; b++) {
          int carry = (a + b + j) / 2;
          int cur = (a + b + j) % 2;
          if (cur == s[i] - '0' && (a ^ b) == x[i] - '0')
            dp[i][j] += dp[i - 1][carry];
        }
    }
  if (sn == xn)
    cout << dp[s.length() - 1][0] - 2 << endl;
  else
    cout << dp[s.length() - 1][0] << endl;
}
