#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;
  long long And = (Sm - Xor);
  if (And & 1) {
    cout << 0;
    return 0;
  }
  And /= 2;
  int n = max(bits(And), bits(Xor));
  long long res = 1;
  for (int i = 0; i < n; ++i) {
    int cur_bit = n - i - 1;
    if (get_bit(Xor, cur_bit)) {
      if (get_bit(And, cur_bit)) {
        cout << 0;
        return 0;
      }
      res *= 2;
    }
  }
  cout << res - 2 * (Sm == Xor);
  return 0;
}
