#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6, inf = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n, s;
  cin >> n >> s;
  long long int d = n - s;
  if (d & 1) cout << "0\n", exit(0);
  d /= 2;
  long long int res = 1;
  for (int i = 0; i < 60; i++) {
    if (s & (1LL << i)) {
      res *= 2LL;
      if (d & (1LL << i)) cout << "0\n", exit(0);
    }
  }
  if (n == s) res -= 2;
  cout << res << "\n";
  return 0;
}
