#include <bits/stdc++.h>
using namespace std;
template <class c1>
ostream &_out(ostream &ost, c1 a, c1 b);
template <class T1, class T2>
ostream &operator<<(ostream &ost, pair<T1, T2> _cnt);
template <class T1>
ostream &operator<<(ostream &ost, vector<T1> _cnt) {
  return _out(ost, _cnt.begin(), _cnt.end());
}
template <class T1>
ostream &operator<<(ostream &ost, deque<T1> _cnt) {
  return _out(ost, _cnt.begin(), _cnt.end());
}
template <class T1>
ostream &operator<<(ostream &ost, queue<T1> _cnt) {
  return _out(ost, _cnt.begin(), _cnt.end());
}
template <class T1>
ostream &operator<<(ostream &ost, list<T1> _cnt) {
  return _out(ost, _cnt.begin(), _cnt.end());
}
template <class T1, class T2>
ostream &operator<<(ostream &ost, set<T1, T2> _cnt) {
  return _out(ost, _cnt.begin(), _cnt.end());
}
template <class T1, class T2, class T3>
ostream &operator<<(ostream &ost, map<T1, T2, T3> _cnt) {
  return _out(ost, _cnt.begin(), _cnt.end());
}
template <class T1, class T2>
ostream &operator<<(ostream &ost, multiset<T1, T2> _cnt) {
  return _out(ost, _cnt.begin(), _cnt.end());
}
template <class T1, class T2, class T3>
ostream &operator<<(ostream &ost, multimap<T1, T2, T3> _cnt) {
  return _out(ost, _cnt.begin(), _cnt.end());
}
template <class T1, class T2>
ostream &operator<<(ostream &ost, pair<T1, T2> _cnt) {
  return ost << '(' << _cnt.first << ", " << _cnt.second << ')';
}
template <class T1>
ostream &_out(ostream &ost, T1 a, T1 b) {
  ost << '{';
  if (a != b) {
    ost << *a;
    while (++a != b) ost << ' ' << *a;
  }
  return ost << '}';
}
template <class Type, unsigned N, unsigned Last>
struct tuple_printer {
  static void print(std::ostream &out, const Type &value) {
    out << std::get<N>(value) << ", ";
    tuple_printer<Type, N + 1, Last>::print(out, value);
  }
};
template <class Type, unsigned N>
struct tuple_printer<Type, N, N> {
  static void print(std::ostream &out, const Type &value) {
    out << std::get<N>(value);
  }
};
template <class... Types>
std::ostream &operator<<(std::ostream &out, const std::tuple<Types...> &value) {
  out << '(';
  tuple_printer<std::tuple<Types...>, 0, sizeof...(Types) - 1>::print(out,
                                                                      value);
  out << ')';
  return out;
}
vector<string> _split(const string &s, char c) {
  int br = 0;
  vector<string> v(1);
  for (int i = 0; i < (((int)(s).size())); ++i) {
    if (s[i] == '[' || s[i] == '(' || s[i] == '{' || s[i] == '<')
      br++;
    else if (s[i] == ']' || s[i] == ')' || s[i] == '}' || s[i] == '>')
      br--;
    if (s[i] == c && br == 0)
      v.push_back("");
    else
      v.back().push_back(s[i]);
  }
  return move(v);
}
void _erre(vector<string>::iterator it) { (void)it; }
template <class T, class... Args>
void _erre(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << '\n';
  _erre(++it, args...);
}
void _err(vector<string>::iterator it) {
  (void)it;
  cerr << '\n';
}
template <class T, class... Args>
void _err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << ", ";
  _err(++it, args...);
}
template <class T>
T maxx(T g) {
  return g;
}
template <class T, class... Args>
T maxx(T a, Args... args) {
  return max(a, maxx(args...));
}
template <class T>
T minn(T g) {
  return g;
}
template <class T, class... Args>
T minn(T a, Args... args) {
  return min(a, minn(args...));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  long long sm, xr, rz;
  cin >> sm >> xr;
  rz = sm - xr;
  if ((sm - xr) % 2 == 1 || rz < 0) {
    cout << 0 << '\n';
    return 0;
  }
  bitset<64> b_rz(rz), b_xr(xr);
  for (long long i = (63); i >= (1); --i) {
    if (b_rz[i] == 1 && b_xr[i - 1] == 1) {
      cout << 0 << '\n';
      return 0;
    }
  }
  cout << (1ll << ((long long)b_xr.count())) - 2 * (sm == xr) << '\n';
  return 0;
}
