import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); sc.close(); if ((a & b) != a) { System.out.println(0); return; } int c = b - a; int cnt = 0; for (int i = 0; i <= 32; i++) { if ((c >> i & 1) == 1) { cnt++; } } System.out.println(1L << (cnt - 1)); } }