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]); if ((a & b) != a) { System.out.println(0); return; } int count = 0; int c = b - a; while (c > 0) { count += c % 2; c /= 2; } System.out.println((long)(Math.pow(2, count - 1))); } }