#include <bits/stdc++.h>   using namespace std;   const long double eps = 1e-9;   const long double pi = acos(-1.0);   const long long inf = 1e+9;   #pragma comment(linker,  /STACK:36777216 )   template <typename T>   istream &operator>>(istream &, vector<T> &);   template <typename T>   ostream &operator<<(ostream &, const vector<T> &);   long long s, x;   int bit(long long x, int pos) { return (x & (1LL << pos)) > 0; }   void solve() {     cin >> s >> x;     int l = 45;     while (bit(s, l) == 0) l--;     vector<vector<long long> > dp(l + 2, vector<long long>(2, 0));     dp[0][0] = 1;     for (int i = 1; i <= l + 1; i++) {       int bs = bit(s, i - 1);       int bx = bit(x, i - 1);       if (bs == 0) {         if (bx == 0) {           dp[i][0] = dp[i - 1][0];           dp[i][1] = dp[i - 1][0];         } else {           dp[i][1] += 2 * dp[i - 1][1];         }       } else {         if (bx == 0) {           dp[i][0] = dp[i - 1][1];           dp[i][1] = dp[i - 1][1];         } else {           dp[i][0] += 2 * dp[i - 1][0];         }       }     }     long long ans = dp[l + 1][0];     if (x > s) ans = 0;     if (x == 0) {       if (s % 2 == 0)         ans = 1;       else         ans = 0;     }     if (x == s) ans -= 2;     cout << ans << endl;   }   int main() {     solve();     return 0;   }   template <typename T>   istream &operator>>(istream &is, vector<T> &v) {     for (int i = 0; i < v.size(); ++i) is >> v[i];     return is;   }   template <typename T>   ostream &operator<<(ostream &os, const vector<T> &v) {     for (int i = 0; i < v.size(); ++i) os << v[i];     return os;   }   