#include <bits/stdc++.h>
using namespace std;
long long int dp[41][2], s, x;
long long int myfind(long long int index, long long int carry) {
  if (index >= 40) {
    if (carry == 0) return 1;
    return 0;
  }
  if (dp[index][carry] == -1) {
    long long int t1, t2, t3, t4, ns, nc, nx, ans = 0;
    t1 = 0;
    t2 = 0;
    ns = (t1 + t2 + carry) % 2;
    nc = (t1 + t2 + carry) / 2;
    nx = t1 ^ t2;
    t3 = (s & (1ll << index));
    t4 = (x & (1ll << index));
    if (t3) t3 = 1;
    if (t4) t4 = 1;
    if (t3 == ns && t4 == nx) {
      ans += myfind(index + 1, nc);
    }
    t1 = 0;
    t2 = 1;
    ns = (t1 + t2 + carry) % 2;
    nc = (t1 + t2 + carry) / 2;
    nx = t1 ^ t2;
    t3 = (s & (1ll << index));
    t4 = (x & (1ll << index));
    if (t3) t3 = 1;
    if (t4) t4 = 1;
    if (t3 == ns && t4 == nx) {
      ans += myfind(index + 1, nc);
    }
    t1 = 1;
    t2 = 0;
    ns = (t1 + t2 + carry) % 2;
    nc = (t1 + t2 + carry) / 2;
    nx = t1 ^ t2;
    t3 = (s & (1ll << index));
    t4 = (x & (1ll << index));
    if (t3) t3 = 1;
    if (t4) t4 = 1;
    if (t3 == ns && t4 == nx) {
      ans += myfind(index + 1, nc);
    }
    t1 = 1;
    t2 = 1;
    ns = (t1 + t2 + carry) % 2;
    nc = (t1 + t2 + carry) / 2;
    nx = t1 ^ t2;
    t3 = (s & (1ll << index));
    t4 = (x & (1ll << index));
    if (t3) t3 = 1;
    if (t4) t4 = 1;
    if (t3 == ns && t4 == nx) {
      ans += myfind(index + 1, nc);
    }
    dp[index][carry] = ans;
  }
  return dp[index][carry];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, j, ans;
  cin >> s >> x;
  for (i = 0; i < 41; i++) {
    for (j = 0; j < 2; j++) dp[i][j] = -1;
  }
  ans = myfind(0, 0);
  if (s == x) ans -= 2;
  cout << ans << endl;
  return 0;
}
