#include <bits/stdc++.h>
using namespace std;
long long mInv[41];
long long fact[41];
long long factInv[41];
map<pair<long long, long long>, long long> mymap;
long long heights[5];
long long segTree[3];
long nums[5005];
long g[5005];
vector<long> primes;
vector<long> badPrimes;
long funcVal[1000006];
long long N;
set<string> dictionary;
set<string>::iterator it;
pair<set<string>::iterator, bool> ret;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long getmoduloInv(long long n) {
  if (n == 1) return 1;
  if (mInv[n] > 0) return mInv[n];
  long long m = (-1 * 1000000007) / n;
  m += 1000000007;
  m *= getmoduloInv(1000000007 % n);
  mInv[n] = (m % 1000000007);
  return mInv[n];
}
vector<long> get_primes(unsigned long maxN) {
  char *sieve;
  sieve = new char[maxN / 8 + 1];
  long m = (maxN / 8) + 1;
  for (long long i = 0; i < m; i++) sieve[i] = 255;
  for (unsigned long x = 2; x <= maxN; x++)
    if (sieve[x / 8] & (0x01 << (x % 8))) {
      primes.push_back(x);
      for (unsigned long j = 2 * x; j <= maxN; j += x)
        sieve[j / 8] &= ~(0x01 << (j % 8));
    }
  delete[] sieve;
  return primes;
}
long long getPow(long long b, long long p) {
  if (b < 2 || p == 1) return b;
  if (p == 0) return 1;
  long long val = getPow(b, p / 2);
  val *= val;
  val %= 1000000007;
  if (p % 2 == 1) {
    val *= b;
    val %= 1000000007;
  }
  return val;
}
void buildSegTree(long node, long b, long e) {
  if (b == e)
    segTree[node] = b;
  else {
    long mid = (b + e) / 2;
    buildSegTree(node * 2, b, mid);
    buildSegTree(1 + node * 2, mid + 1, e);
    if (heights[segTree[node * 2]] <= heights[segTree[1 + node * 2]])
      segTree[node] = segTree[node * 2];
    else
      segTree[node] = segTree[1 + node * 2];
  }
}
long long getMin(long node, long segBeg, long segEnd, long qBeg, long qEnd) {
  if (segEnd < qBeg || segBeg > qEnd) return N + 1;
  if (segBeg >= qBeg && segEnd <= qEnd) return segTree[node];
  long mid = (segBeg + segEnd) / 2;
  long fh = getMin(node * 2, segBeg, mid, qBeg, qEnd);
  long sh = getMin(1 + node * 2, mid + 1, segEnd, qBeg, qEnd);
  if (heights[sh] < heights[fh]) return sh;
  return fh;
}
string genMinString(long long val) {
  long len = val / 9, firstDigit = val % 9;
  string s = "";
  if (firstDigit > 0) {
    char ch = '0' + firstDigit;
    s = ch + s;
  }
  for (long i = 0; i < len; i++) s = s + "9";
  return s;
}
long maxBuild;
vector<long> mult(vector<long> A, vector<long> B) {
  long len1 = A.size(), len2 = B.size();
  vector<long> C;
  for (long i = 0; i < len1; i++) {
    long carry = 0;
    for (long j = 0; j < len2; j++) {
      long pos = i + j;
      long val = carry + (A[i] * B[j]);
      carry = val / 10;
      val = val % 10;
      if (pos >= C.size()) {
        C.push_back(val);
      } else {
        C[pos] += val;
        carry = C[pos] / 10;
        C[pos] = C[pos] % 10;
      }
    }
    if (carry > 0) C.push_back(carry);
  }
  return C;
}
vector<long> getVal(long power) {
  vector<long> C;
  C.push_back(5);
  if (power == 1) return C;
  vector<long> B = getVal(power / 2);
  B = mult(B, B);
  if (power % 2 == 1) B = mult(B, C);
  return B;
}
long long getBit(long long num) {
  long long bitNUm = 0, temp = 1;
  while (temp <= num) {
    temp = temp << 1;
    bitNUm++;
  }
  return bitNUm;
}
long long getorderdPairs(long long s, long long x) {
  pair<long long, long long> op;
  op.first = s;
  op.second = x;
  long long rem1 = s % 2, rem2 = x % 2;
  if (rem1 != rem2 || s < x) return 0;
  if (s == 2) {
    if (x == 0) return 1;
    return 2;
  }
  if (s == 1) return 2;
  if (mymap[op] == 0) {
    if (rem1 == 1) return getorderdPairs(s / 2, x / 2) * 2;
    return getorderdPairs(s / 2, x / 2) + getorderdPairs((s / 2) - 1, (x / 2));
  }
  return mymap[op];
}
long long checkVal(long long s, long long x) {
  long long ways = 0;
  for (long long i = 1; i < s; i++) {
    long long r = s - i;
    long long v = (i ^ r);
    if (v == x) ways++;
  }
  return ways;
}
void check() {
  for (long i = 2; i < 900; i++) {
    for (long j = 0; j <= i; j++) {
      long long v1 = checkVal(i, j), v2 = getorderdPairs(i, j);
      if (v1 != v2 && (i != j || v1 + 2 != v2)) cout << i << " " << j << endl;
    }
  }
}
int main(void) {
  long long test_cases = 1, l, r, seed = 1, maxVal;
  long long curNum;
  long long s, x;
  for (long T = 0; T < test_cases; T++) {
    cin >> s >> x;
    long long val1 = getorderdPairs(s, x);
    if (s == x) val1 -= 2;
    cout << val1 << endl;
  }
  return 0;
}

### Prompt

Generate a CPP solution to the following problem:

Two positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)?

Input

The first line of the input contains two integers s and x (2 ≤ s ≤ 1012, 0 ≤ x ≤ 1012), the sum and bitwise xor of the pair of positive integers, respectively.

Output

Print a single integer, the number of solutions to the given conditions. If no solutions exist, print 0.

Examples

Input

9 5


Output

4


Input

3 3


Output

2


Input

5 2


Output

0

Note

In the first sample, we have the following solutions: (2, 7), (3, 6), (6, 3), (7, 2).

In the second sample, the only solutions are (1, 2) and (2, 1).

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long mInv[41];
long long fact[41];
long long factInv[41];
map<pair<long long, long long>, long long> mymap;
long long heights[5];
long long segTree[3];
long nums[5005];
long g[5005];
vector<long> primes;
vector<long> badPrimes;
long funcVal[1000006];
long long N;
set<string> dictionary;
set<string>::iterator it;
pair<set<string>::iterator, bool> ret;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long getmoduloInv(long long n) {
  if (n == 1) return 1;
  if (mInv[n] > 0) return mInv[n];
  long long m = (-1 * 1000000007) / n;
  m += 1000000007;
  m *= getmoduloInv(1000000007 % n);
  mInv[n] = (m % 1000000007);
  return mInv[n];
}
vector<long> get_primes(unsigned long maxN) {
  char *sieve;
  sieve = new char[maxN / 8 + 1];
  long m = (maxN / 8) + 1;
  for (long long i = 0; i < m; i++) sieve[i] = 255;
  for (unsigned long x = 2; x <= maxN; x++)
    if (sieve[x / 8] & (0x01 << (x % 8))) {
      primes.push_back(x);
      for (unsigned long j = 2 * x; j <= maxN; j += x)
        sieve[j / 8] &= ~(0x01 << (j % 8));
    }
  delete[] sieve;
  return primes;
}
long long getPow(long long b, long long p) {
  if (b < 2 || p == 1) return b;
  if (p == 0) return 1;
  long long val = getPow(b, p / 2);
  val *= val;
  val %= 1000000007;
  if (p % 2 == 1) {
    val *= b;
    val %= 1000000007;
  }
  return val;
}
void buildSegTree(long node, long b, long e) {
  if (b == e)
    segTree[node] = b;
  else {
    long mid = (b + e) / 2;
    buildSegTree(node * 2, b, mid);
    buildSegTree(1 + node * 2, mid + 1, e);
    if (heights[segTree[node * 2]] <= heights[segTree[1 + node * 2]])
      segTree[node] = segTree[node * 2];
    else
      segTree[node] = segTree[1 + node * 2];
  }
}
long long getMin(long node, long segBeg, long segEnd, long qBeg, long qEnd) {
  if (segEnd < qBeg || segBeg > qEnd) return N + 1;
  if (segBeg >= qBeg && segEnd <= qEnd) return segTree[node];
  long mid = (segBeg + segEnd) / 2;
  long fh = getMin(node * 2, segBeg, mid, qBeg, qEnd);
  long sh = getMin(1 + node * 2, mid + 1, segEnd, qBeg, qEnd);
  if (heights[sh] < heights[fh]) return sh;
  return fh;
}
string genMinString(long long val) {
  long len = val / 9, firstDigit = val % 9;
  string s = "";
  if (firstDigit > 0) {
    char ch = '0' + firstDigit;
    s = ch + s;
  }
  for (long i = 0; i < len; i++) s = s + "9";
  return s;
}
long maxBuild;
vector<long> mult(vector<long> A, vector<long> B) {
  long len1 = A.size(), len2 = B.size();
  vector<long> C;
  for (long i = 0; i < len1; i++) {
    long carry = 0;
    for (long j = 0; j < len2; j++) {
      long pos = i + j;
      long val = carry + (A[i] * B[j]);
      carry = val / 10;
      val = val % 10;
      if (pos >= C.size()) {
        C.push_back(val);
      } else {
        C[pos] += val;
        carry = C[pos] / 10;
        C[pos] = C[pos] % 10;
      }
    }
    if (carry > 0) C.push_back(carry);
  }
  return C;
}
vector<long> getVal(long power) {
  vector<long> C;
  C.push_back(5);
  if (power == 1) return C;
  vector<long> B = getVal(power / 2);
  B = mult(B, B);
  if (power % 2 == 1) B = mult(B, C);
  return B;
}
long long getBit(long long num) {
  long long bitNUm = 0, temp = 1;
  while (temp <= num) {
    temp = temp << 1;
    bitNUm++;
  }
  return bitNUm;
}
long long getorderdPairs(long long s, long long x) {
  pair<long long, long long> op;
  op.first = s;
  op.second = x;
  long long rem1 = s % 2, rem2 = x % 2;
  if (rem1 != rem2 || s < x) return 0;
  if (s == 2) {
    if (x == 0) return 1;
    return 2;
  }
  if (s == 1) return 2;
  if (mymap[op] == 0) {
    if (rem1 == 1) return getorderdPairs(s / 2, x / 2) * 2;
    return getorderdPairs(s / 2, x / 2) + getorderdPairs((s / 2) - 1, (x / 2));
  }
  return mymap[op];
}
long long checkVal(long long s, long long x) {
  long long ways = 0;
  for (long long i = 1; i < s; i++) {
    long long r = s - i;
    long long v = (i ^ r);
    if (v == x) ways++;
  }
  return ways;
}
void check() {
  for (long i = 2; i < 900; i++) {
    for (long j = 0; j <= i; j++) {
      long long v1 = checkVal(i, j), v2 = getorderdPairs(i, j);
      if (v1 != v2 && (i != j || v1 + 2 != v2)) cout << i << " " << j << endl;
    }
  }
}
int main(void) {
  long long test_cases = 1, l, r, seed = 1, maxVal;
  long long curNum;
  long long s, x;
  for (long T = 0; T < test_cases; T++) {
    cin >> s >> x;
    long long val1 = getorderdPairs(s, x);
    if (s == x) val1 -= 2;
    cout << val1 << endl;
  }
  return 0;
}

```