#include <bits/stdc++.h>
using namespace std;
const int INF = (-1u) / 2;
const long long int INF2 = (-1ull) / 2;
long long int a, b, i, d[1011000], j, k, n, m, timer = 0, l, r, x, y;
long long int c[1011000], cnt = 0, fl = 0, a2, a3 = -1000000, ans = 0;
long long int dp[250][10];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> x >> y;
  for (i = 0; i < 50; i++) {
    a = (x & (1ll << i));
    b = (y & (1ll << i));
    if (a) a = 1;
    if (b) b = 1;
    for (l = 0; l <= 1; l++) {
      for (r = 0; r <= 1; r++) {
        if ((l ^ r) != b) continue;
        if (i == 0) {
          if ((l + r) % 2 != a) continue;
          dp[i][(l + r) / 2]++;
          continue;
        }
        for (j = 0; j <= 6; j++) {
          if ((l + r + j) % 2 != a) continue;
          dp[i][(l + r + j) / 2] += dp[i - 1][j];
        }
      }
    }
  }
  ans = dp[49][0];
  if (x == y) ans -= 2ll;
  cout << ans << endl;
  return 0;
}
