#include <bits/stdc++.h>
using namespace std;
long long s, x;
long long one = 1;
int flag;
long long int dp[2][100];
long long func(int carry, int bit, int mbit) {
  int sbit = (s & (one << bit)) ? 1 : 0;
  int xbit = (x & (one << bit)) ? 1 : 0;
  if (dp[carry][bit] != -1) return dp[carry][bit];
  if (bit >= 60) {
    return carry ? 0 : 1;
  }
  if (carry == 0) {
    if (xbit == 1 && sbit == 1) {
      return dp[carry][bit] = 2ll * func(0, bit + 1, mbit);
    }
    if (xbit == 0 && sbit == 1) {
      { return dp[carry][bit] = 0; }
    }
    if (xbit == 0 && sbit == 0) {
      return dp[carry][bit] = func(1, bit + 1, mbit) + func(0, bit + 1, mbit);
    }
    if (xbit == 1 && sbit == 0) {
      return dp[carry][bit] = 0;
    }
  } else {
    if (xbit == 1 && sbit == 1) {
      return dp[carry][bit] = 0;
    }
    if (xbit == 0 && sbit == 1) {
      {
        return dp[carry][bit] = func(0, bit + 1, mbit) + func(1, bit + 1, mbit);
      }
    }
    if (xbit == 0 && sbit == 0) {
      return dp[carry][bit] = 0;
    }
    if (xbit == 1 && sbit == 0) {
      return dp[carry][bit] = 2 * func(1, bit + 1, mbit);
    }
  }
}
int main() {
  int i, j, fl, test, ans = 1;
  scanf("%lld%lld", &s, &x);
  int carr = 0;
  i = 0;
  long long j1 = s;
  memset(dp, -1, sizeof(dp));
  while (j1) {
    i++;
    j1 = j1 / 2;
  }
  j1 = x;
  test = 0;
  while (j1) {
    test++;
    j1 = j1 / 2;
  }
  if (test > i) {
    printf("0\n");
    return 0;
  }
  if (test == i) {
    flag = 0;
  } else
    flag = 1;
  test = max(test, i);
  if (s == x)
    fl = 2;
  else
    fl = 0;
  printf("%lld\n", func(0, 0, test) - fl);
  return 0;
}
