#include <bits/stdc++.h>
using namespace std;
long long x, y;
int main() {
  int t;
  while (scanf("%lld%lld", &x, &y) != EOF) {
    long long ans = 0;
    x -= y;
    if (x % 2 == 1) {
      cout << '0' << endl;
      continue;
    }
    x /= 2;
    int flag = 0, d = 0;
    if (!x) d = 2;
    for (int i = 0; i < 64; i++) {
      int a1 = x & 1;
      int a2 = y & 1;
      if (a1 == 1 && a2 == 1) {
        flag = 1;
        break;
      }
      x >>= 1;
      y >>= 1;
      if (a2 == 0) continue;
      ans++;
    }
    if (flag)
      cout << '0' << endl;
    else
      cout << (1ll << ans) - d << endl;
  }
  return 0;
}
