#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29, N = 5e5 + 50, M = 1e6 + 5;
inline long long read() {
  long long f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void judge() {
  freopen("data.in", "r", stdin);
  freopen("data.out", "w", stdout);
}
map<pair<pair<long long, long long>, bool>, long long> f;
inline long long dp(long long s, long long x, bool jin) {
  if (f[make_pair(make_pair(s, x), jin)])
    return f[make_pair(make_pair(s, x), jin)];
  long long &res = f[make_pair(make_pair(s, x), jin)];
  if (s == 0 && x == 0) {
    if (jin)
      return res = 0;
    else
      return res = 1;
  }
  int v1 = s & 1, v2 = x & 1;
  for (int(i) = (0); (i) <= (1); (i)++)
    for (int(j) = (0); (j) <= (1); (j)++) {
      if (((i + j + jin) & 1) == v1 && ((i ^ j) == v2))
        res += dp(s >> 1, x >> 1, (i + j + jin) >> 1);
    }
  return res;
}
int main() {
  long long s = read(), x = read();
  cout << dp(s, x, 0) - (s == x) * 2;
}
