XOR Equation

Count ordered pairs of positive integers A and B with A+B=S and A xor B=X.

Medium6MathBit manipulationInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

You are given two positive integers SS and XX. Count the ordered pairs (A,B)(A, B) of positive integers that satisfy A+B=SA + B = S and AB=XA \oplus B = X, where \oplus is the bitwise exclusive or.

Both AA and BB must be at least 11. If ABA \neq B, then (A,B)(A, B) and (B,A)(B, A) count as two different pairs.

Input

The first line contains two positive integers SS and XX, separated by a space. (2S,X10122 \le S, X \le 10^{12})

Output

Print on the first line the number of ordered pairs (A,B)(A, B) that satisfy both equations.