#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int main() {
  long long a, b;
  cin >> a >> b;
  long long t = a - b;
  if (t < 0 || t >> 1 & b || t & 1) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = 1;
  bool flag = a == b;
  while (b > 0) {
    if (b & 1) {
      ans <<= 1;
    }
    b >>= 1;
  }
  cout << (flag ? ans - 2 : ans) << endl;
  return 0;
}
