#include <bits/stdc++.h>
using namespace std;
int sumb[64];
int xorb[64];
long long s, r;
int maxx = 0;
void bits() {
  int i = 0;
  long long bf = s;
  while (bf) {
    sumb[i] = bf % 2;
    ++i;
    bf /= 2;
  }
  maxx = i;
  bf = r;
  i = 0;
  while (bf) {
    xorb[i] = bf % 2;
    ++i;
    bf /= 2;
    maxx = max(maxx, i);
  }
}
long long ansv[2][65][2][2];
bool ch[2][65][2][2];
long long calc(int ost, int pos, int f1, int f2) {
  if (ch[ost][pos][f1][f2]) {
    return ansv[ost][pos][f1][f2];
  }
  ch[ost][pos][f1][f2] = 1;
  if (pos >= 64) {
    if (ost == 0 && f1 == f2 && f2 == 1) {
      return 1;
    } else {
      return 0;
    }
  }
  long long ans = 0;
  for (long long(x1) = 0; (x1) < (2); ++(x1)) {
    for (long long(x2) = 0; (x2) < (2); ++(x2)) {
      long long p;
      if ((x1 + x2 + ost) % 2 == sumb[pos] &&
          ((x1 == x2 && 0 == xorb[pos]) || (x1 != x2 && 1 == xorb[pos]))) {
        p = calc(((x1 + x2 + ost) > 1), pos + 1, (x1 != 0) || f1,
                 (x2 != 0) || f2);
        ans += p;
      }
    }
  }
  return ansv[ost][pos][f1][f2] = ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> s >> r;
  bits();
  cout << calc(0, 0, 0, 0);
  return 0;
}
