#include <bits/stdc++.h>
using namespace std;
const int MX = 2e5 + 9;
const long long inf = (1ll << 60);
const long long mod = 1e9 + 7;
long long s, x, res;
vector<long long> a, b;
int main() {
  cin >> s >> x;
  if (x > s || (s - x) % 2) {
    puts("0");
    return 0;
  }
  for (int i = 0; i <= 50; i++) {
    if (x & (1ll << i)) res++;
  }
  res = (1ll << res) - 2;
  if (x == s) {
    cout << res << endl;
    return 0;
  }
  res += 2;
  long long tmp = s - x;
  tmp /= 2;
  for (int i = 0; i < 50; i++) {
    if ((x & (1ll << i)) && (tmp & (1ll << i))) {
      puts("0");
      return 0;
    }
  }
  cout << res << endl;
}
