#include <bits/stdc++.h>
using namespace std;
long long pangkat2(long long n) {
  long long tmp = 1;
  for (int i = 1; i <= n; i++) tmp *= 2;
  return tmp;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  if ((a - b) % 2 == 1) return cout << 0 << endl, 0;
  long long n = (a - b) / 2;
  if (n & b) return cout << 0 << endl, 0;
  long long x = __builtin_popcountll(b);
  if (a == b)
    cout << pangkat2(x) - 2 << endl;
  else
    cout << pangkat2(x) << endl;
}
