#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 2;
const int INF = 2e9 + 10;
const int ALPH = 300;
const long long MOD = 1e9 + 7;
const long long P = 29;
int a[N], b[N];
long long rec(long long second, long long x) {
  if (second < 0 || x < 0) return 0;
  if (second == 0 && x == 0) return 1;
  if (second == 1 && x == 1) return 2;
  if ((second & 1ll) ^ (x & 1ll)) return 0;
  if ((second & 1ll) && (x & 1ll)) return 2ll * rec(second / 2, x / 2);
  if (!(second & 1ll) && !(x & 1ll))
    return rec(second / 2ll, x / 2ll) + rec(second / 2ll - 1, x / 2ll);
}
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long second, x;
  cin >> second >> x;
  long long ans = rec(second, x);
  if (second == x) ans -= 2;
  cout << ans;
}
