#include <bits/stdc++.h>
using namespace std;
long long s, x;
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> s >> x;
  long long f = 2;
  long long cnt = 0;
  for (long long i = 0; i <= 63; i++) {
    long long c1 = (s >> i) & 1, c2 = (x >> i) & 1;
    if (f == 1 && (c1 == c2)) return cout << 0 << endl, 0;
    if (f == 2 && (c1 != c2)) return cout << 0 << endl, 0;
    f = 0;
    if (c1 == 1 && c2 == 1) {
      cnt++;
      f = 2;
    }
    if (c1 == 0 && c2 == 1) {
      cnt++;
      f = 1;
    }
  }
  long long ans = (1LL << cnt);
  if (s == x)
    cout << ans - 2 << endl;
  else
    cout << ans << endl;
}
