#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
void solve() {
  long long x, y;
  cin >> x >> y;
  if (x < y) {
    cout << 0 << "\n";
    return;
  }
  if ((x - y) % 2 == 1) {
    cout << 0 << "\n";
    return;
  }
  vector<long long> v(50, 0);
  long long diff = x - y;
  diff /= 2;
  long long ans = 0;
  if (diff == 0) ans -= 2;
  long long cnt = 0;
  for (long long i = 49; i >= 0; i--) {
    if ((y) & ((long long)1 << i)) {
      cnt++;
      continue;
    }
    long long x = (long long)1 << i;
    if (diff >= x) {
      diff -= x;
      v[i] = 1;
    }
  }
  if (diff > 0) {
    cout << 0 << "\n";
    return;
  } else
    ans += ((long long)1 << cnt);
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
}
