#include <bits/stdc++.h>
int main() {
  long long a, b, c;
  scanf("%I64d%I64d", &a, &b);
  c = a - b;
  return 0 * printf("%I64d", c >= 0 && (c & (~b << 1)) == c
                                 ? (1ll << __builtin_popcountll(b)) - 2 * (!c)
                                 : 0);
}
