import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" ", 2); int a = Integer.parseInt(line[0]); int b = Integer.parseInt(line[1]); int count = 0; while (a > 0 && b > 0) { if (a % 2 == 0 && b % 2 == 1) { count++; } else if (a % 2 == 1 && b % 2 == 0) { System.out.println(0); return; } a /= 2; b /= 2; } System.out.println((long)(Math.pow(2, count - 1))); } }