using static System.Math; using System; public class Hello { public static long a, b; static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); a = long.Parse(line[0]); b = long.Parse(line[1]); getAns(); } static bool check(long t, int p) => ((t >> p) & 1) == 1; static void getAns() { var imax = countBIT(Max(a, b)); var count = 0; for (int i = 0; i < imax; i++) { if (check(a, i) && !check(b, i)) { Console.WriteLine(0); return; } if (!check(a, i) && check(b, i)) count++; } Console.WriteLine(Pow(2, count - 1)); } static int countBIT(long bits) { bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); return (int)(bits & 0x0000ffff) + (int)(bits >> 16 & 0x0000ffff); } }