#include <bits/stdc++.h>
using namespace std;
void read() {}
long long int dp[64][2], s, x;
int m;
long long int cs(int i = 0, bool acc = 0) {
  if (i == m + 1 && !acc) return 1;
  if (i == m + 1) return 0;
  long long int &ret = dp[i][acc];
  if (ret != -1) return ret;
  if ((x & (1ll << i)) && (s & (1ll << i)) && !acc)
    return ret = 2 * cs(i + 1, 0);
  if ((x & (1ll << i)) && (s & (1ll << i)) && acc) return ret = 0;
  if ((x & (1ll << i)) && !(s & (1ll << i)) && !acc) return ret = 0;
  if ((x & (1ll << i)) && !(s & (1ll << i)) && acc)
    return ret = 2 * cs(i + 1, 1);
  if (!((x & (1ll << i))) && (s & (1ll << i)) && acc)
    return ret = cs(i + 1, 0) + cs(i + 1, 1);
  if (!(x & (1ll << i)) && (s & (1ll << i)) && !acc) return ret = 0;
  if (!(x & (1ll << i)) && !(s & (1ll << i)) && !acc)
    return ret = cs(i + 1, 0) + cs(i + 1, 1);
  if (!(x & (1ll << i)) && !(s & (1ll << i)) && acc) return ret = 0;
}
int main() {
  read();
  while (scanf("%lld %lld", &s, &x) == 2) {
    if (x > s) {
      printf("0\n");
      continue;
    }
    memset(dp, -1, sizeof dp);
    for (int i = 62; i >= 0; i--)
      if (s & (1ll << i)) {
        m = i;
        break;
      }
    long long int ans = cs();
    if ((s ^ 0) == x) ans -= 2;
    printf("%lld\n", ans);
  }
}
