#include <bits/stdc++.h>
using namespace std;
const int N = 60;
struct bit {
  int q[N], n;
  bit(long long x = 0) {
    memset(q, 0, sizeof(q));
    n = 0;
    while (x) {
      q[n] = x & 1;
      x >>= 1;
      n++;
    }
    if (!q[n]) n--;
  }
} ss, sx;
int main() {
  long long x, s;
  while (cin >> s >> x) {
    ss = bit(s);
    sx = bit(x);
    int n = max(ss.n, sx.n);
    long long ans = 1;
    int flg = 0;
    for (int i = n; i >= 1; i--) {
      int a = ss.q[i], b = sx.q[i];
      int &c = ss.q[i - 1];
      switch (a) {
        case 0: {
          if (b) flg = 1;
          break;
        }
        case 1: {
          if (b)
            ans *= 2;
          else
            c += 2;
          break;
        }
        case 2: {
          if (b) {
            ans *= 2;
            c += 2;
          }
          break;
        }
        case 3: {
          if (b)
            flg = 1;
          else {
            c += 2;
          }
        }
      }
      if (flg) break;
    }
    int a = ss.q[0], b = sx.q[0];
    if (a == b || (a == 2 && b == 0)) {
      if (a == b && a == 1) ans *= 2;
    } else
      flg = 1;
    if (flg)
      puts("0");
    else {
      if (s == x) ans -= 2;
      cout << ans << endl;
    }
  }
}
