#include <bits/stdc++.h>
using namespace std;
int dr[] = {1, 0, -1, 0, -1, -1, 1, 1};
int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
const int MAX = 1e4 + 7;
const int MOD = 1e9 + 7;
int main() {
  long long s, x, ans = 1, r;
  cin >> s >> x;
  if ((s - x) % 2 != 0 || (s - x) / 2 < 0) return (cout << "0\n", 0);
  r = (s - x) / 2;
  if (s - x == 0)
    s = -2;
  else
    s = 0;
  while (x) {
    int br = r % 2;
    r /= 2;
    int bx = x % 2;
    x /= 2;
    if (bx == 0) continue;
    if (bx && br) return (cout << "0\n", 0);
    ans *= 2;
  }
  cout << ans + s << "\n";
}
