#include <bits/stdc++.h>
using namespace std;
long long a, b, c, tem, flag;
int main() {
  scanf("%I64d%I64d", &a, &b);
  c = a - b;
  if (c < 0 || c & 1) {
    puts("0");
    return 0;
  }
  c >>= 1;
  tem = 1;
  if (c == 0) flag = -2;
  while (b || c) {
    if (b & 1) {
      tem = (c & 1) ? 0 : (tem << 1);
    }
    b >>= 1;
    c >>= 1;
  }
  printf("%I64d\n", tem + flag);
  return 0;
}
