import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int count = 0; while (a > 0 && b > 0) { int aa = a % 2; int bb = b % 2; if (aa == 0 && bb == 1) { count++; } else if (aa == 1 && bb == 0) { count = 0; break; } a /= 2; b /= 2; } if (count == 0) { System.out.println(0); } else { System.out.println((long)(Math.pow(2, count - 1))); } } }