#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int s, t;
  bitset<47> a, b;
  cin >> s;
  cin >> t;
  b = (s - t) / 2;
  a = t;
  int fl = 0;
  if ((s - t) & 1) {
    cout << 0;
    return 0;
  }
  long long int ans = 1;
  for (int i = 46; i >= 0; i--) {
    if (a[i] == 1) {
      if (b[i] == 0)
        ans = (ans * 2);
      else {
        fl = 1;
        break;
      }
    }
  }
  if (fl == 1)
    cout << 0;
  else if (s == t)
    cout << ans - 2;
  else
    cout << ans;
}
