#include <bits/stdc++.h>
using namespace std;
long long solve(long long s, long long x) {
  if (s == 0) {
    if (x == 0) return 1;
    return 0;
  }
  if (x % 2 == 1) {
    if (s % 2 == 0) return 0;
    return 1LL * 2 * solve(s / 2, x / 2);
  }
  if (s % 2 == 1) return 0;
  return solve(s / 2 - 1, x / 2) + solve(s / 2, x / 2);
}
int main() {
  long long s, x;
  cin >> s >> x;
  if (s == x)
    cout << solve(s, x) - 2 << endl;
  else
    cout << solve(s, x) << endl;
}
