#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const int oo = 2e9;
const int B = 2e5;
long long sum, Xor;
void Solve(int T) {
  cin >> sum >> Xor;
  long long And = (sum - Xor) / 2;
  if (sum % 2 != Xor % 2) {
    cout << 0;
    return;
  }
  if ((And & Xor)) {
    cout << 0;
    return;
  }
  long long ans = (1ll << __builtin_popcountll(Xor));
  if (Xor == sum)
    cout << ans - 2;
  else
    cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  if (fopen("CF"
            ".inp",
            "r")) {
    freopen(
        "CF"
        ".inp",
        "r", stdin);
    freopen(
        "CF"
        ".out",
        "w", stdout);
  }
  int test = 1;
  for (int i = 1; i <= test; ++i) {
    Solve(i);
  }
}
