#include <bits/stdc++.h>
using namespace std;
long long dp[60][2];
bool get_bit(long long num, int idx) { return (num & (1LL << idx)); }
int bits(long long num) { return 1 + log(num) / log(2); }
int main() {
  long long Sm, Xor;
  cin >> Sm >> Xor;
  int n = max(bits(Sm), bits(Xor));
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    int cur_bit = n - i - 1;
    bool Sm_bit = get_bit(Sm, cur_bit);
    bool Xor_bit = get_bit(Xor, cur_bit);
    for (int j = 0; j < 2; ++j)
      if (j) {
        if (Sm_bit == 0 && Xor_bit == 1)
          dp[i + 1][j] = dp[i][1] * 2;
        else if (Sm_bit == 1 && Xor_bit == 0)
          dp[i + 1][j] = dp[i][1] + dp[i][0];
        else
          dp[i + 1][j] = 0;
      } else {
        if (Sm_bit == 0 && Xor_bit == 0)
          dp[i + 1][j] = dp[i][1] + dp[i][0];
        else if (Sm_bit == 1 && Xor_bit == 1)
          dp[i + 1][j] = dp[i][0] * 2;
        else
          dp[i + 1][j] = 0;
      }
  }
  cout << dp[n][0] - 2 * (Sm == Xor);
  return 0;
}
