#include <bits/stdc++.h>
using namespace std;
vector<int> G[2 * 100000 + 5];
signed long long int S, X;
int fdp[60][3];
signed long long int dp[60][3];
bool checkBit(signed long long int x, int b) { return (x & (1LL << b)); }
signed long long int rec(int b, int c) {
  if (b == 60) {
    if (c == 0) return 1;
    return 0;
  }
  if (fdp[b][c]) return dp[b][c];
  fdp[b][c] = 1;
  dp[b][c] = 0;
  for (auto m : {0, 1}) {
    for (auto n : {0, 1}) {
      bool s = checkBit(m + n + c, 0);
      bool new_c = checkBit(m + n + c, 1);
      bool x = m ^ n;
      if (s == checkBit(S, b) and x == checkBit(X, b)) {
        dp[b][c] += rec(b + 1, new_c);
      }
    }
  }
  return dp[b][c];
}
int main() {
  cin >> S >> X;
  cout << rec(0, 0) - (S == X ? 2 : 0);
}
