#include <bits/stdc++.h>
using namespace std;
int sum;
bool ary[100];
int main() {
  long long n, p;
  cin >> n >> p;
  long long t = n - p;
  if (t < 0 || t % 2 == 1) {
    cout << 0 << endl;
    return 0;
  }
  int tmp = 0;
  while (p) {
    if (p % 2) {
      ary[tmp] = true;
      sum++;
    }
    tmp++;
    p /= 2;
  }
  t /= 2;
  tmp = 0;
  int ch = 0;
  if (t == 0) ch = 2;
  while (t) {
    if (t % 2) {
      if (ary[tmp]) {
        cout << 0 << endl;
        return 0;
      }
      ary[tmp] = true;
    }
    tmp++;
    t /= 2;
  }
  cout << (1ll << sum) - ch << endl;
  return 0;
}
