#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  LL suma, nim;
  cin >> suma >> nim;
  if (nim > suma) {
    cout << 0;
    return 0;
  }
  LL w = (suma - nim);
  if (w % 2 == 0)
    w = 0;
  else
    w = 1;
  if (w == 1) {
    cout << 0;
    return 0;
  }
  LL wyn = 1;
  LL x = (suma - nim) / 2;
  for (int i = 0; i <= 40; i++) {
    LL y = (x >> i);
    if (y % 2 == 0)
      y = 0;
    else
      y = 1;
    LL z = (nim >> i);
    if (z % 2 == 0)
      z = 0;
    else
      z = 1;
    if (y == 1 && z == 1) {
      cout << 0 << endl;
      return 0;
    }
    if (y == 0 && z == 1) {
      wyn = wyn * 2;
    }
  }
  if (suma == nim) wyn = wyn - 2;
  cout << wyn;
}
