#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 1;
long long dp[N];
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long s, x;
  cin >> s >> x;
  long long p = __builtin_popcountll(x);
  s -= x;
  if (s % 2) return cout << 0, 0;
  s = s / 2;
  if (x & s) return cout << 0, 0;
  p = (long long)pow(2, p);
  if (s == 0) {
    p -= 2;
  }
  cout << p;
}
