#include <bits/stdc++.h>
using namespace std;
void FFF() {
  cout.precision(18);
  cout << fixed;
}
void FST() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
}
long long n, m, i, j, kol;
int main() {
  cin >> n >> m;
  if (n - m < 0 || (n - m) % 2 == 1 || (m & ((n - m) / 2)) != 0) {
    cout << 0;
    return 0;
  }
  j = (n - m) / 2;
  while (m > 0) {
    if (m % 2 == 1) ++kol;
    m >>= 1;
  }
  if (j == 0)
    cout << (1LL << kol) - 2;
  else
    cout << (1LL << kol);
}
