import java.io.*;
import java.util.*;

public class bits_vd_n2 {
	public long solve(int l, int r) throws IOException {
		int res = 0;
		for (int i = l; i <= r; i++) {
			for (int j = l; j <= r; j++) {
				int k = (i | j) ^ j;
				if (k >= l && k <= r) {
					res++;
				}
			}
		}
		return res;
	}

	final String fileName = "bits_vd_".split("_")[0];

	public void run() throws IOException {
		br = new BufferedReader(new FileReader(fileName + ".in"));
		out = new PrintWriter(fileName + ".out");
		out.println(solve(nextInt(), nextInt()));
		out.close();
		br.close();
	}

	public static void main(String[] args) throws IOException {
		new bits_vd_n2().run();
	}

	BufferedReader br;
	StringTokenizer str;
	PrintWriter out;

	String next() throws IOException {
		while (str == null || !str.hasMoreTokens()) {
			str = new StringTokenizer(br.readLine());
		}
		return str.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

}