#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000100;
const int INF = 1e9 + 10;
long long s, x;
long long dp[62][2][2][2];
long long dfs(int i, int v, int cur, int pre) {
  long long &res = dp[i][v][cur][pre];
  if (~res) return res;
  if (i == 0) {
    if (pre)
      return res = 0;
    else {
      int xx = 0, ss = 0;
      if (x & (1ll << i)) xx = 1;
      if (s & (1ll << i)) ss = 1;
      int u = xx ^ v;
      if (v == 0 && u == 0)
        return res = (ss == 0 && cur == 0);
      else if (v == 0 && u == 1)
        return res = (ss == 1 && cur == 0);
      else if (v == 1 && u == 0)
        return res = (ss == 1 && cur == 0);
      else
        return res = (ss == 0 && cur == 1);
    }
  }
  res = 0;
  int xx = 0, ss = 0;
  if (x & (1ll << i)) xx = 1;
  if (s & (1ll << i)) ss = 1;
  int u = xx ^ v;
  if ((u + v + pre) % 2 != ss) return res = 0;
  if ((u + v + pre) / 2 != cur) return res = 0;
  for (int pv = 0; pv <= 1; pv++) {
    for (int ppre = 0; ppre <= 1; ppre++) {
      res += dfs(i - 1, pv, pre, ppre);
    }
  }
  return res;
}
int cnt(long long s) {
  int res = 0;
  while (s) {
    s /= 2;
    res++;
  }
  return res;
}
int main() {
  while (cin >> s >> x) {
    memset(dp, -1, sizeof(dp));
    int cut = 0;
    if (s == x) cut = 2;
    int len = cnt(s);
    int len2 = cnt(x);
    if (len2 > len) {
      puts("0");
      continue;
    }
    cout << dfs(len, 0, 0, 0) - cut << endl;
  }
  return 0;
}

### Prompt

Please formulate 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;
const int maxn = 1000100;
const int INF = 1e9 + 10;
long long s, x;
long long dp[62][2][2][2];
long long dfs(int i, int v, int cur, int pre) {
  long long &res = dp[i][v][cur][pre];
  if (~res) return res;
  if (i == 0) {
    if (pre)
      return res = 0;
    else {
      int xx = 0, ss = 0;
      if (x & (1ll << i)) xx = 1;
      if (s & (1ll << i)) ss = 1;
      int u = xx ^ v;
      if (v == 0 && u == 0)
        return res = (ss == 0 && cur == 0);
      else if (v == 0 && u == 1)
        return res = (ss == 1 && cur == 0);
      else if (v == 1 && u == 0)
        return res = (ss == 1 && cur == 0);
      else
        return res = (ss == 0 && cur == 1);
    }
  }
  res = 0;
  int xx = 0, ss = 0;
  if (x & (1ll << i)) xx = 1;
  if (s & (1ll << i)) ss = 1;
  int u = xx ^ v;
  if ((u + v + pre) % 2 != ss) return res = 0;
  if ((u + v + pre) / 2 != cur) return res = 0;
  for (int pv = 0; pv <= 1; pv++) {
    for (int ppre = 0; ppre <= 1; ppre++) {
      res += dfs(i - 1, pv, pre, ppre);
    }
  }
  return res;
}
int cnt(long long s) {
  int res = 0;
  while (s) {
    s /= 2;
    res++;
  }
  return res;
}
int main() {
  while (cin >> s >> x) {
    memset(dp, -1, sizeof(dp));
    int cut = 0;
    if (s == x) cut = 2;
    int len = cnt(s);
    int len2 = cnt(x);
    if (len2 > len) {
      puts("0");
      continue;
    }
    cout << dfs(len, 0, 0, 0) - cut << endl;
  }
  return 0;
}

```