#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
bool chmin(T1 &a, T2 b) {
  return b < a && (a = b, true);
}
template <class T1, class T2>
bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}
int main() {
  long long S, X;
  cin >> S >> X;
  bitset<60> s(S), x(X);
  static long long dp[100][2];
  dp[0][0] = 1;
  for (int i = 0; i < (60); i++)
    for (int j = 0; j < (2); j++) {
      for (int a = 0; a < (2); a++) {
        int b = (s[i] + a + j) % 2;
        if ((a ^ b) == x[i]) {
          dp[i + 1][(a + b + j) / 2] += dp[i][j];
        }
      }
    }
  if (s == x) dp[60][0] -= 2;
  cout << dp[60][0] << endl;
  return 0;
}
