#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int s, x;
  cin >> s >> x;
  long long int i, c = 1, f = 0;
  long long int a = (s - x) / 2;
  if ((s - x) % 2 != 0)
    cout << 0;
  else {
    for (i = 0; i < 64; i++) {
      long long int x1 = ((x >> i) & 1);
      long long int a1 = ((a >> i) & 1);
      if (x1 == 0 && a1 == 1) f = 1;
      if (x1 == 1 && a1 == 0) c = c * 2;
      if (x1 == 1 && a1 == 1) {
        f = 1;
        c = 0;
      }
    }
    if (f == 1)
      cout << c;
    else
      cout << (c - 2);
  }
}
