A little girl loves problems on bitwise operations very much. Here's one of them.You are given two integers l and r. Let's consider the values of  for all pairs of integers a and b (l ≤ a ≤ b ≤ r). Your task is to find the maximum value among all considered ones.Expression  means applying bitwise excluding or operation to integers x and y. The given operation exists in all modern programming languages, for example, in languages C++ and Java it is represented as "^", in Pascal — as "xor".

The single line contains space-separated integers l and r (1 ≤ l ≤ r ≤ 1018). Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.

In a single line print a single integer — the maximum value of  for all pairs of integers a, b (l ≤ a ≤ b ≤ r).

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

public class Main {
    private static StringTokenizer st;
    private static BufferedReader br;

    public static void print(Object x) {
        System.out.println(x + "");
    }
    public static String join(List<?> x, String space) {
        StringBuilder sb = new StringBuilder();
        for (Object elt : x) {
            sb.append(elt);
            sb.append(space);
        }
        return sb.toString();
    }

    public static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine().trim());
        }
        return st.nextToken();
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public static int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public static List<Integer> nextInts(int n) throws IOException{
        List<Integer> lst = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            lst.add(nextInt());
        }
        return lst;
    }

    public static class StringNode {
        public boolean isPrefix;
        public int letter;
        public long l;
        public long c;
        public long start;
        public long length;

        public StringNode(long start, int letter) {
            this.letter = letter;
            this.start = start;
            this.length = 1;
            isPrefix = false;
        }
        public StringNode(long start, long l, long c) {
            this.l = l;
            this.c = c;
            this.start = start;
            this.length = l * c;
            isPrefix = true;
        }

        public int getChar(long i, List<Integer> prefix) {
            if (isPrefix) {
                i = i % l;
                return prefix.get((int) i);
            } else {
                return letter;
            }
        }
    }

    public static int largestBit(long x) {
        if (x == 0) {
            return -1;
        } else {
            return largestBit(x / 2) + 1;
        }
    }

    public static long solve(long l, long r) {
        if (l == 0 && r == 0) {
            return 0;
        }
        if (largestBit(l) == largestBit(r)) {
            long mod = (long) Math.pow(2, largestBit(l));
            return solve(l % mod, r % mod);
        }

        int largest = Math.max(largestBit(l), largestBit(r));
        return ((long) Math.pow(2, largest + 1)) - 1;
    }

    public static void main(String[] args) throws Exception {
        boolean debug = false;
        InputStream in = System.in;
        if (debug) {
            in = new FileInputStream("input.in");
        }
        br = new BufferedReader(new InputStreamReader(in));

        long l = nextLong();
        long r = nextLong();
        print(solve(l, r));
    }
}

import java.util.Scanner;

/**
 * @Created by sbhowmik on 09/10/18
 */
public class LittleGirlAndXor {
    public static long maxXor(long a, long b) {
//        long xor = 0;
//        xor = a ^ b;
//        int flag = 0;
//        long k = 0;
//        long index = 0;
//        long count = 0;
//        while (xor > 0) {
//            if ((xor&1) > 0) {
//                index = count;
//            }
//            count++;
//            k++;
//            xor = xor >> 1;
//        }
//        return (1<<index+1)-1;

        long LXR = a ^ b;
        long msbPos = 0;
        while (LXR > 0)
        {
            msbPos++;
            LXR >>= 1;
        }
        long maxXOR = 0;
        long two = 1;
        while (msbPos-- >0)
        {
            maxXOR += two;
            two <<= 1;
        }

        return maxXOR;
    }
    public static void main(String []args) {

        Scanner scanner = new Scanner(System.in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        long xor = 0;

        System.out.print(maxXor(a,b));
    }
}

/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x276D
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         long N = Long.parseLong(st.nextToken());
         long M = Long.parseLong(st.nextToken());
         for(int b=62; b >= 0; b--)
            if((N&(1L<<b)) > 0 && (M&(1L<<b)) == 0 || (N&(1L<<b)) == 0 && (M&(1L<<b)) > 0)
            {
               b++;
               System.out.println((1L << b) - 1);
               return;
            }
         int hentai = 0;
         System.out.println(hentai);
      }
   }

import java.util.Scanner;

public class Main {
    static int getBit(long n, int i) {
        return (int) ((n >> i) & 1);
    }

    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);

        long l = in.nextLong(), r = in.nextLong();

        int firstBit = -1;
        for (int i = 59; i >= 0; --i) {
            if (getBit(l, i) != getBit(r, i)) {
                firstBit = i;
                break;
            }
        }

        long ans = (1L << (firstBit + 1)) - 1;
        System.out.println(ans);
    }
}

//package codeforces;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Scanner;

public class CodeForces {

    //private static MyScanner sc;
    private static MyPrinter out;

    public static void solve() throws IOException {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        String ls = Long.toBinaryString(l);
        String rs = Long.toBinaryString(r);
        while (ls.length() < rs.length()) {
            ls = "0" + ls;
        }
        String res = "";
        boolean ok = false;
        for (int i = 0; i < ls.length(); i++) {
            if (ok) {
                res += "1";
            } else {
                if (ls.charAt(i) != rs.charAt(i)) {
                    res += "1";
                    ok = true;
                }
            }
        }
        long all = 0;
        for (int i = 0; i < res.length(); i++) {
            all += (long) Math.pow((long) 2, (long) res.length() - 1 - i);
        }
        System.out.println(all);
    }

    public static void main(String[] args) throws IOException {
        //sc = new MyScanner(System.in);
        out = new MyPrinter(System.out);
        solve();
        out.close();
    }
}

class MyScanner {

    private StreamTokenizer st;

    public MyScanner(InputStream is) {
        st = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));
    }

    public MyScanner(File f) throws FileNotFoundException {
        st = new StreamTokenizer(new BufferedReader(new FileReader(f)));
    }

    public int nextInt() throws IOException {
        st.nextToken();
        return ((int) st.nval);
    }

    public double nextDouble() throws IOException {
        st.nextToken();
        return (st.nval);
    }

    public String nextString() throws IOException {
        st.nextToken();
        if (st.ttype == StreamTokenizer.TT_WORD) {
            return (st.sval);
        } else {
            return ("not found");
        }
    }
}

class MyPrinter {

    private BufferedWriter out;

    public MyPrinter(OutputStream os) {
        out = new BufferedWriter(new PrintWriter(os));
    }

    public MyPrinter(File f) throws IOException {
        out = new BufferedWriter(new FileWriter(f));
    }

    public void println(int i) throws IOException {
        out.write(Integer.toString(i));
        out.newLine();
    }

    public void println(double d) throws IOException {
        out.write(Double.toString(d));
        out.newLine();
    }

    public void println(long l) throws IOException {
        out.write(Long.toString(l));
        out.newLine();
    }

    public void println(String s) throws IOException {
        out.write(s);
        out.newLine();
    }

    public void println(char c) throws IOException {
        out.write(Character.toString(c));
        out.newLine();
    }

    public void print(int i) throws IOException {
        out.write(Integer.toString(i));
    }

    public void print(double d) throws IOException {
        out.write(Double.toString(d));
    }

    public void print(long l) throws IOException {
        out.write(Long.toString(l));
    }

    public void print(String s) throws IOException {
        out.write(s);
    }

    public void print(char c) throws IOException {
        out.write(Character.toString(c));
    }

    public void close() throws IOException {
        out.flush();
        out.close();
    }
}

import java.util.Scanner;
import java.math.BigInteger;

public class cf276d
{
    public static void main( String args[] )
    {
        Scanner sc = new Scanner( System.in );
        while( sc.hasNextLong() )
        {
            long b = sc.nextLong();
            long a = sc.nextLong();
            //System.out.println("a:"+a+" b:"+b);
            long ans = 0;
            int i = 0;
            for( i = 63; i >= 0; i-- )
            {
                long use = ((long)1)<<i;
                //System.out.println(use+" aanduse:"+(a&use)+" banduse:"+(b&use));
                if( ((a&use) > 0) && ((b&use) == 0) )
                {

                    //System.out.println("dito nagiba:"+i);
                    ans+=use;
                    i--;
                    break;
                }
            }
            for( ; i >= 0; i-- )
            {
                //System.out.println(i);
                ans+=(((long)1)<<i);
            }

            System.out.println(ans);
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

	public void solve() throws IOException {
		out.println( Math.max(0, Long.highestOneBit(nextLong() ^ nextLong()) * 2 - 1) );
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new D().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

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

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

}

import java.util.Scanner;

public class D {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long l = s.nextLong();
        long r = s.nextLong();
        long a = l ^ r;
        long b = a;
        while (b != 0) {
            a = b;
            b = (b-1) & b;
        }
        if (a != 0) {
            a = (a << 1) - 1;
        }
        System.out.println(a);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Test {

	public static void main(String[] args) {
		FastReader in = new FastReader();
		long left=in.nextLong(),right=in.nextLong();
		if(left==right)
		{
			System.out.println(0);
			return;
		}
		int largestUnequalBitPos=0;
		for(int i=0;left>0||right>0;i++)
		{
			if(left%2!=right%2)
				largestUnequalBitPos=i;

			left>>=1;
			right>>=1;

		}
		long res=(1L<<(largestUnequalBitPos+1))-1;
		System.out.println(res);

	}

}
class FastReader {
	BufferedReader br;
	StringTokenizer st;

	public FastReader() {
		br = new BufferedReader(new InputStreamReader(System.in));

	}

	String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {
				e.printStackTrace();
			}

		}

		return st.nextToken();

	}

	int nextInt() {

		return Integer.parseInt(next());
	}

	double nextDouble() {

		return Double.parseDouble(next());
	}

	long nextLong() {

		return Long.parseLong(next());
	}

	String nextLine() {
		String str = "";
		try {
			str = br.readLine();

		} catch (IOException e) {

			e.printStackTrace();
		}
		return str;

	}
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zakhar Voit
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        out.println(solve(in.nextLong(), in.nextLong()));
        /*for (long l = 1; l < 500; l++) {
            for (long r = l; r < 500; r++) {
                if (badSolve(l, r) != solve(l, r)) {
                    out.println(l + " " + r);
                    return;
                }
            }
        }
        out.println("OK");*/
    }

    long solve(long l, long r) {
        if (l == r)
            return 0;
        long ans = l ^ (l + 1);

        for (int i = 0; i < 62; i++) {
            l |= (1l << i);
            if (l + 1 <= r)
                ans = (1l << (i + 2l)) - 1;
        }

        return ans;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    public String nextToken() {
        if (!tok.hasMoreTokens()) {
            try {
                String newLine = in.readLine();
                if (newLine == null)
                    throw new InputMismatchException();
                tok = new StringTokenizer(newLine);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            return nextToken();
        }

        return tok.nextToken();
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }

    }

import java.io.BufferedReader;
import java.io.InputStreamReader;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author pttrung
 */
public class D {

    static long[][][][][] dp;
    static String l, r;

    public static void main(String[] args) {
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            String[] temp = in.readLine().split(" ");
            long L = Long.parseLong(temp[0]);
            long R = Long.parseLong(temp[1]);

            if (L == R) {
                System.out.println(0);
            } else {
                dp = new long[64][2][2][2][2];

                l = convert(L);
                r = convert(R);
                if (r.length() > l.length()) {
                    while (r.length() > l.length()) {
                        l = '0' + l;
                    }
                }
                for (int i = 0; i < dp.length; i++) {
                    for (int j = 0; j < dp[0].length; j++) {
                        for (int k = 0; k < dp[0][0].length; k++) {
                            for (int m = 0; m < dp[0][0][0].length; m++) {
                                for (int n = 0; n < dp[0][0][0][0].length; n++) {
                                    dp[i][j][k][m][n] = -1;
                                }
                            }
                        }
                    }
                }
                long result = cal(0, 0, 0, 0, 0);
                System.out.println(result);
            }
            // System.out.println(l + " " + r);

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public static long cal(int p, int AcL, int AcR, int BcL, int BcR) {
        if (p == l.length()) {
            return 0;
        }
        if (dp[p][AcL][AcR][BcL][BcR] != -1) {
            return dp[p][AcL][AcR][BcL][BcR];
        }
        int min1 = 0, max1 = 1;
        if (AcL == 0 && l.charAt(p) == '1') {
            min1 = 1;
        }
        if (AcR == 0 && r.charAt(p) == '0') {
            max1 = 0;
        }
        int min2 = 0, max2 = 1;
        if (BcL == 0 && l.charAt(p) == '1') {
            min2 = 1;
        }
        if (BcR == 0 && r.charAt(p) == '0') {
            max2 = 0;
        }
        long result = 0;
        for (int i = min1; i <= max1; i++) {
            for (int j = min2; j <= max2; j++) {
                long v = i ^ j;
               if(v == 1){
                   v = 1L << (r.length() - p - 1);
               }
                // System.out.println(val);
                int acL = AcL, acR = AcR, bcL = BcL, bcR = BcR;
                if (i == 1 && l.charAt(p) == '0') {
                    acL = 1;
                }
                if (i == 0 && r.charAt(p) == '1') {
                    acR = 1;
                }
                if (j == 1 && l.charAt(p) == '0') {
                    bcL = 1;
                }
                if (j == 0 && r.charAt(p) == '1') {
                    bcR = 1;
                }
                long total = v + cal(p + 1, acL, acR, bcL, bcR);
                result = Math.max(total, result);
            }
        }
        dp[p][AcL][AcR][BcL][BcR] = result;
        return result;
    }

    public static String convert(long val) {
        StringBuilder builder = new StringBuilder();
        while (val > 0) {
            if (val % 2 != 0) {
                builder.insert(0, '1');
            } else {
                builder.insert(0, '0');
            }
            val >>= 1;
        }
        return builder.toString();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;

public class d {
    static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        StringBuilder sb = new StringBuilder();
       String[] ss=s();long index=-1;
         long l=l(ss[0]);long r=l(ss[1]);
         for(long i=63;i>=0;i--){
             long lval=l&(1L<<i);
             long rval=r&(1L<<i);
       //      System.out.println(lval+" "+rval+" "+i);
             if(lval!=rval){
                 index=i;break;
             }
         }long ans=0;
         long power=1;long pi=0;
         while(pi<=index){
             ans+=power;pi++;power*=2;
         //    System.out.println(power+" "+index);
         }
        System.out.println(ans);

    }
    static String[] s() throws IOException {
        return s.readLine().trim().split("\\s+");
    }

    static int i(String ss) {
        return Integer.parseInt(ss);
    }

    static long l(String ss) {
        return Long.parseLong(ss);
    }

    static int MAXN;
    static int[] spf;
    static void sieve() {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)
            spf[i] = i;
        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;
        for (int i=3; i*i<MAXN; i++)
        {
            if (spf[i] == i)
            {
                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }
    static long powerwithmod(long  x, long y, long p) {
        long  res = 1;
        x = x % p;
        while (y > 0) {
            if ((y & 1) == 1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }static long[] fac ;
    static void calculatefac(long mod){
        fac[0]=1;
        for (int i = 1 ;i <= MAXN; i++)
            fac[i] = fac[i-1] * i % mod;
    }
    static long nCrModPFermat(int n, int r, long mod) {
        if (r == 0)
            return 1;
        fac[0] = 1;
        return (fac[n]*
                modInverse(fac[r], mod)
                % mod * modInverse(fac[n-r], mod)
                % mod) % mod;
    }static long modInverse(long a, long m)
    {
        return (powerwithmod(a, m - 2, m));
    }

}

class Student12 {
    int  l;long r;
    public Student12(int l, long r) {
        this.l = l;
        this.r = r;
    }

    public String toString()
    {
        return this.l+" ";
    }
}
class Sortbyroll12 implements Comparator<Student12> {

    public int compare(Student12 a, Student12 b){
        if(a.l<=b.r) return -1;
     /*   else if(a.r==b.r){
            if(a.r==b.r){
                return 0;
            }
            if(a.r<b.r) return -1;
            return 1;}*/
        return 1;  }
}

import java.util.*;
import java.lang.*;
import java.util.Scanner;

public class Main
{
        public static void main (String[] args) throws java.lang.Exception
        {
                Scanner sc = new Scanner( System.in );
                long l = sc.nextLong();
                long r = sc.nextLong();
                die(l,r);
        }
        public static void die (long l, long r){
                long k = (long)Math.floor(Math.log(r)/Math.log(2));
                long q = (long)Math.pow(2,k);
                if(l==r){
                    System.out.println(0);
                }
                else{
                    if(l<q){
                    System.out.println(2*q-1);
                }
                else{
                    die(l-q,r-q);
                }
                }
        }
}

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

public class test {
    static boolean DEBUG_FLAG = false;
    int INF = (int)1e9;
    long MOD = 1000000007;

    static void debug(String s) {
        if(DEBUG_FLAG) {
            System.out.print(s);
        }
    }

    String bin(long x) {
        if(x<=0) return "0";
        if(x==1) return "1";
        return bin(x/2) + (x%2);
    }

    long dec(String s) {
//        System.out.println("s: "+s);
        if(s.length()==0) return 0;
        return 2 * dec(s.substring(0, s.length()-1)) + (s.charAt(s.length()-1)-'0');
//        return 2 * dec(s.substring(1, s.length())) + (s.charAt(0)-'0');
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        long l = in.nextLong();
        long r = in.nextLong();
        long sl = l, sr = r;
        String a = bin(l);
        String b = bin(r);
        while(a.length()!=b.length()) {
            a = "0"+a;
        }
        String rs = "";
        boolean f = false;
        for(int i=0; i<b.length(); i++) {
            int x = b.charAt(i)-'0';
            int y = a.charAt(i)-'0';
//            if(f) {
//                rs = rs + 1;
//            } else {
                if(x==1) {
                    if(y==0) {
                        rs = rs + 1;
                    } else {
                        long p = 1l << (b.length()-1-i);
                        if(r - p >= sl) {
                            rs = rs + 1;
                            r -= p;
                        } else {
                            if(l - p >= sl) {
                                rs = rs + 1;
                                l -= p;
                            } else
                                rs = rs + 0;
                        }
                    }
                } else {
                    if(y==0) {
                        long p = 1l << (b.length()-1-i);
                        if(l+p <= sr) {
                            l += p;
                            rs = rs + 1;
                        } else {
                            if(r + p <= sr) {
                                rs += p;
                                rs = rs + 1;
                            } else
                                rs = rs + 0;
                        }
                    } else {
                        rs = rs + 1;
                    }
                }
//            }
        }
//        out.println(b);
//        out.println(a);
//        out.println(rs);
        long ans = dec(rs);
        out.println(ans);
//        String t = bin(576460752303423487l);
//        while(t.length()!=b.length()) {
//            t = 0 + t;
//        }
//        out.println(t);
//        out.println(dec(t));
    }

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new test().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }

    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class b{
	public static void main(String args[]) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer(br.readLine());
		long l=Long.parseLong(st.nextToken());
		long r=Long.parseLong(st.nextToken());
		String l_b=Long.toBinaryString(l);
		String r_b=Long.toBinaryString(r);
		int len_l=l_b.length();
		int len_r=r_b.length();
		if(len_l<len_r){
			for(int i=0;i<(len_r-len_l);i++) l_b="0"+l_b;
		}
		boolean eq=true;
		String ans="";
		for(int i=0;i<len_r;i++){
			if(!eq) ans+="1";
			else{
				if(l_b.charAt(i)!=r_b.charAt(i)){
					eq=false;
					ans+="1";
				} else ans+="0";
			}
		}
		System.out.println(Long.valueOf(ans,2));
	}
}

import java.util.*;
import java.io.*;
import java.awt.Point;

public class CF276D {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] buffer = br.readLine().split(" ");
		long left = Long.parseLong(buffer[0]);
		long right = Long.parseLong(buffer[1]);
		if(left == right) {
			System.out.println(0);
			return;
		}
		String leftStr = Long.toBinaryString(left);
		String rightStr = Long.toBinaryString(right);
		int x = leftStr.length();
		int y = rightStr.length();
		int p = y - x;
		String tmp = "";
		for(int f = 0; f < p; f ++)tmp+="0";
		leftStr = tmp + leftStr;
		x = leftStr.length();
		//System.out.println(leftStr);
		//System.out.println(rightStr);
		String res = "";
		int i = 0;
		boolean onePresent = false;
		while(i < x && leftStr.charAt(i) == rightStr.charAt(i)) i++;
		int n = x - i;
		for(int k = 0; k<n; k++)res += "1";
		//System.out.println(res);
		System.out.println(Long.parseLong(res, 2));

		// res = rightStr.substring(0, y - x);
		// for(int i = 0; i < x; i++) {
		// 	res = res + "1";
		// }
		//System.out.println(Long.parseLong(res, 2));
	}

}

import java.math.BigInteger;
import java.util.Scanner;

public class D {

	static Scanner scanner = new Scanner(System.in);
	static BigInteger a, b;
	static String s1, s2;
	static BigInteger two = new BigInteger("2");

	public static void main(String[] args) {
		a = scanner.nextBigInteger();
		b = scanner.nextBigInteger();
		s1 = a.toString(2);
		s2 = b.toString(2);
		int exp = s2.length();
		if (s1.length() == s2.length()) {
			for (int i=0;i<s2.length();++i) {
				if (s1.charAt(i) == s2.charAt(i)) {
					exp--;
					continue;
				}
				else {
					break;
				}
			}
		}
		System.out.println(two.pow(exp).subtract(BigInteger.ONE));
	}

}

/**
 * DA-IICT
 * Author : PARTH PATEL
 */
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class D276
{

	public static int mod = 1000000007;
	static FasterScanner in = new FasterScanner();
	static PrintWriter out = new PrintWriter(System.out);
	public static int logbase2(long a)
	{
		int ans=(int) ceil(((log(a)/log(2))+1e-10));
		return ans;
	}
	public static void main(String[] args)
	{
		long l=in.nextLong();
		long r=in.nextLong();
		int bits=max(logbase2(l), logbase2(r));
		long answer=0;
		if(l==r)
		{
			out.println("0");
			out.flush();
			return;
		}
		for(int i=bits-1;i>=0;i--)
		{
			long lbit=(l & (1L<<i))==0?0:1;
			long rbit=(r & (1L<<i))==0?0:1;
			if(lbit==rbit)
				continue;
			else
			{
				answer=(long) (pow(2, i+1, Long.MAX_VALUE)-1);
				break;
			}
		}
		out.println(answer);
		out.close();

	}

	public static long pow(long x, long n, long mod)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p) % mod)
		{
			if ((n & 1) != 0)
			{
				res = (res * p % mod);
			}
		}
		return res;
	}

	public static long gcd(long n1, long n2)
	{
		long r;
		while (n2 != 0)
		{
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2)
	{
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

	static class FasterScanner
	{
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

		public int read()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = System.in.read(buf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n)
		{
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextLong();
			}
			return arr;
		}

		private boolean isSpaceChar(int c)
		{
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}
	}

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main
{
	public static void main(String[] args)
    throws IOException
	{

        BufferedReader reader = new BufferedReader(
            new InputStreamReader(System.in));

        String []arr = reader.readLine().split(" ");
        long x,y;
        x = Long.parseLong(arr[0]);
        y = Long.parseLong(arr[1]);

        if((x ^ y) == 0)
            System.out.println(0);
        else
        {

            /*
             //System.out.println(1L<<63);
             long maxLong = 1L << 62;

             while((x & maxLong) == (y & maxLong))
             {
             maxLong >>= 1;
             }

             System.out.println((maxLong << 1) - 1);
             */

            String strX = Long.toBinaryString(x);
            String strY = Long.toBinaryString(y);

            int len1 = strX.length();
            int len2 = strY.length();

            long res;
            if((len1 ^ len2) != 0)
            {

                res = (1L << len2) - 1;
                /*
                 System.out.println(res);
                 res = 1L << (len2 - 1);
                 res ^= (res - 1);
                 */
            }
            else
            {
                int i;
                for(i = 0;i < len1;++i)
                    if(strX.charAt(i) != strY.charAt(i))
                        break;

                res = (1L << (len1 - i)) - 1;

            }

            System.out.println(res);

        }

    }
}

import java.util.Scanner;

public class Main2 {

    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        long s = input.nextLong();
        long e = input.nextLong();
        System.out.println(count(s,e));
    }

    public static long count(long s,long e){
    	int ncount = 0;
    	long es = e;
    	while(es != 0){
    		es /= 2;
    		ncount++;
    	}
    	while(ncount >= 0){
    		if(((s>>ncount-1)&1) == 1 && ((e>>ncount-1)&1) == 0 || ((s>>ncount-1)&1) == 0 && ((e>>ncount-1)&1) == 1){
    			break;
    		}
    		ncount--;
    	}
    	if(ncount >= 0){
    		return (long)Math.pow(2, ncount)-1;
    	}else{
    		return 0;
    	}
    }

}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {

	public static void main(String [] args ) {
		try{
			String str;
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			BufferedOutputStream bos = new BufferedOutputStream(System.out);
			String eol = System.getProperty("line.separator");
			byte [] eolb = eol.getBytes();
			byte[] spaceb= " ".getBytes();

			str  = br.readLine();
			int blank = str.indexOf( " ");
			long l = Long.parseLong(str.substring(0,blank));
			long r = Long.parseLong(str.substring(blank+1));
			String one = "";
			String two = "";
			while(l>0) {
				if((l%2)==0) {
					one = "0".concat(one);
				} else {
					one = "1".concat(one);
				}
				l/=2;
			}
			while(r>0) {
				if((r%2)==0) {
					two = "0".concat(two);
				} else {
					two = "1".concat(two);
				}
				r/=2;
			}
			while(one.length()<60) {
				one = "0".concat(one);
			}
			while(two.length()<60) {
				two = "0".concat(two);
			}
			int iter = 0;
			String xor = "";
			boolean big = false;
			boolean small = false;
			while(one.charAt(iter) == two.charAt(iter)) {
				xor = xor.concat("0");
				iter++;
				if(iter==60) {
					break;
				}
			}
			for(int i = iter ; i < 60 ; i++) {
				xor = xor.concat("1");
			}
			bos.write(new BigInteger(xor,2).toString().getBytes());
			bos.write(eolb);
			bos.flush();
		}  catch(IOException ioe) {
			ioe.printStackTrace();
		}
	}
}

import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.InputMismatchException;

public class max_xor {

    public static void main(String s[]) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        solve(in,out);
        out.close();
    }

    public static void solve(InputReader in, OutputWriter out) {
        long L = in.readLong();
        long R = in.readLong();

        int bit = 63;
        while(bit >= 0 && ((1L<<bit & L) == (1L<<bit & R)) ){
           bit--;
        }

        out.printLine((1L<<bit+1) -1);
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }
}

class OutputWriter {

    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}

import java.util.Scanner;

public class D{
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        long l = input.nextLong();
        long r = input.nextLong();
        String sl = makes(l);
        String sr = makes(r);
        if(!sl.equals(sr)){
            Long ans = proc(sl, sr);
            System.out.println(ans);
        } else{
            System.out.println(0);
        }
    }

    public static String makes(long n){
        String str = "";
        while(n > 0){
            str = String.valueOf(n % 2) + str;
            n /= 2;
        }
        return str;
    }

    public static long proc(String s1, String s2){
        char sl[] = s1.toCharArray();
        char sr[] = s2.toCharArray();
        int cnt = Math.min(sl.length, sr.length);
        int l = Math.max(sl.length, sr.length);
        char ans[] = new char [l];
        if(sl.length != sr.length){
            long ret = (long) Math.pow(2, l) - 1;
            return ret;
        } else{
            int neg = 0;
            for(int i = 0; i < cnt; i++, neg++){
                if(sr[i] != sl[i]) break;
            }
            long ret = (long) Math.pow(2, cnt - neg) - 1;
            return ret;
        }
    }
}

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Random;

public class Solution {

    public static void main(String[] args) {
        try (PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {
            _Scanner sc = new _Scanner(System.in);

            long l = sc.nextLong();
            long r = sc.nextLong();

            for (int i = 62; i >= 0; i--) {
                if ((r >>> i) != (l >>> i)) {
                    out.println((1L << (i + 1)) - 1);
                    return;
                }
            }
            out.println(0);
        }
    }

    private static void reverse(int[] vs) {
        for (int i = 0; i < vs.length / 2; i++) {
            swap(vs, i, vs.length - 1 - i);
        }
    }

    static class _Scanner {
        InputStream is;
        _Scanner(InputStream is) {
            this.is = is;
        }
        byte[] bb = new byte[1 << 15];
        int k, l;
        byte getc() {
            try {
                if (k >= l) {
                    k = 0;
                    l = is.read(bb);
                    if (l < 0) return -1;
                }
                return bb[k++];
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        byte skip() {
            byte b;
            while ((b = getc()) <= 32)
                ;
            return b;
        }

        int nextInt() {
            int n = 0;
            int sig = 1;
            for (byte b = skip(); b > 32; b = getc()) {
                if (b == '-') {
                    sig = -1;
                } else {
                    n = n * 10 + b - '0';
                }
            }
            return sig * n;
        }

        long nextLong() {
            long n = 0;
            long sig = 1;
            for (byte b = skip(); b > 32; b = getc()) {
                if (b == '-') {
                    sig = -1;
                } else {
                    n = n * 10 + b - '0';
                }
            }
            return sig * n;
        }

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

        public String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); b > 32; b = getc()) {
                sb.append(((char) b));
            }
            return sb.toString();
        }
    }

    private static void shuffle(int[] ar) {
        Random rnd = new Random();
        for (int i = 0; i < ar.length; i++) {
            int j = i + rnd.nextInt(ar.length - i);
            swap(ar, i, j);
        }
    }

    private static void shuffle(Object[] ar) {
        Random rnd = new Random();
        for (int i = 0; i < ar.length; i++) {
            int j = i + rnd.nextInt(ar.length - i);
            swap(ar, i, j);
        }
    }

    private static void swap(int[] ar, int i, int j) {
        int t = ar[i];
        ar[i] = ar[j];
        ar[j] = t;
    }

    private static void swap(Object[] ar, int i, int j) {
        Object t = ar[i];
        ar[i] = ar[j];
        ar[j] = t;
    }

}

import java.io.BufferedReader;
// import java.io.FileInputStream;
// import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.round;
import static java.lang.Math.sqrt;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
import static java.util.Collections.reverse;
import static java.util.Collections.reverseOrder;
import static java.util.Collections.sort;
import static java.util.Comparator.comparing;

public class Main {
    FastScanner in;
    PrintWriter out;

    private void solve() throws IOException {
        long l = in.nextLong(), r = in.nextLong();
        for (int i = 61; i >= 0; i--)
            if (((l >> i & 1) ^ (r >> i & 1)) == 1) {
                out.println((1L << (i + 1)) - 1);
                return;
            }
        out.println(0);
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

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

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

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

        String nextLine() throws IOException {
            return br.readLine();
        }

        boolean hasNextLine() throws IOException {
            return br.ready();
        }
    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        solve();

        out.flush();
        out.close();
    }

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

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        new Solution().run();
    }
}

final class Solution implements Runnable {

    long l, r;

    boolean check(long x, int i) {
        return (l >> i) <= x && x <= (r >> i);
    }

    boolean check(long a, long b, int i) {
        return check(a, i) && check(b, i);
    }

    int solve() throws Throwable {
        l = in.nextLong();
        r = in.nextLong();
        long a = 0, b = 0;
        for (int i = 63; i >= 0; i--) {
            long a1 = (a << 1) | 1;
            long b1 = (b << 1);

            long a2 = (a << 1);
            long b2 = (b << 1) | 1;

            long a3 = (a << 1) | 1;
            long b3 = (b << 1) | 1;

            long a4 = (a << 1);
            long b4 = (b << 1);

            if (check(a1, b1, i)) {
                a = a1;
                b = b1;
            } else if (check(a2, b2, i)) {
                a = a2;
                b = b2;
            } else if (check(a3, b3, i)) {
                a = a3;
                b = b3;
            } else {
                a = a4;
                b = b4;
            }
        }
        out.print(a ^ b);
        return 0;
    }

    FastScanner in;
    PrintWriter out;

    @Override
    public void run() {
        try {
            boolean ONLINE_JUDGE = false;
            try {
                Locale.setDefault(Locale.US);
                ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
            } catch (SecurityException e) {
                System.err.println("Operation forbidden");
            }

            long time = System.currentTimeMillis();
            if (ONLINE_JUDGE) {
                in = new FastScanner(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }

            int ret = solve();
            out.close();
            in.close();

            long delta = System.currentTimeMillis() - time;

            long freeMem = Runtime.getRuntime().freeMemory();
            long totalMem = Runtime.getRuntime().totalMemory();

            System.err.printf("Time: %.3f s\n", delta / 1000.0f);
            System.err.printf("Memory: %.3f MB\n", (float)(totalMem - freeMem) / (1 << 20));

            if (ret != 0)
                System.exit(ret);

        } catch (Throwable t) {
            t.printStackTrace(System.err);
            System.exit(-1);
        }
    }
}

@SuppressWarnings("unused")
final class FastScanner {
    BufferedReader bufferedReader;
    StringTokenizer stringTokenizer;

    public FastScanner(Reader r) {
        bufferedReader = new BufferedReader(r);
    }

    public String nextToken() throws IOException, NullPointerException {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens())
            stringTokenizer = new StringTokenizer(bufferedReader.readLine());
        return stringTokenizer.nextToken();
    }

    public String nextLine() throws IOException {
        return bufferedReader.readLine();
    }

    public int nextInt() throws IOException, NullPointerException {
        return Integer.parseInt(nextToken());
    }

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

    public BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

    public float nextFloat() throws IOException {
        return Float.parseFloat(nextToken());
    }

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

    public int read() throws IOException {
        return bufferedReader.read();
    }

    public void close() throws IOException {
        bufferedReader.close();
    }

    public int[] readIntArray(int n) throws Throwable {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return array;
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        close();
    }
}

final class DisjointSetUnion {
    int[] parent;
    int[] rank;

    public DisjointSetUnion(int size) {
        parent = new int[size];
        rank = new int[size];
        for (int i = 0; i < size; i++)
            parent[i] = i;
    }

    public int getLeader(int element) {
        if (parent[element] == element)
            return element;
        else
            return parent[element] = getLeader(parent[element]);
    }

    public boolean union(int x, int y) {
        x = getLeader(x);
        y = getLeader(y);
        if (x == y)
            return true;
        if (rank[x] < rank[y]) {
            int temp = x;
            x = y;
            y = temp;
        }
        parent[y] = x;
        if (rank[x] == rank[y])
            ++rank[x];
        return false;
    }
}

@SuppressWarnings("unused")
final class Utils {
    private Utils() {}

    public static long sqr(long x) {
        return x * x;
    }

    public static int gcd(int x, int y) {
        while (y > 0) {
            x %= y;
            int temp = x;
            x = y;
            y = temp;
        }
        return x;
    }

    public static int lcm(int x, int y) {
        return x / gcd(x, y) * y;
    }

    public static long gcd(long x, long y) {
        while (y > 0) {
            x %= y;
            long temp = x;
            x = y;
            y = temp;
        }
        return x;
    }

    public static long lcm(long x, long y) {
        return x / gcd(x, y) * y;
    }

    public static long modInverse(long x, long mod) {
        return BigInteger.valueOf(x).modInverse(BigInteger.valueOf(mod)).longValue();
    }

    static Random r = new Random(System.nanoTime());

    public static<T> void shuffle(T[] array) {
        int n = array.length;
        for (int i = 0; i < n; i++) {
            int j = r.nextInt(n);
            T t = array[i];
            array[i] = array[j];
            array[j] = t;
        }
    }

    public static void shuffle(int[] array) {
        int n = array.length;
        for (int i = 0; i < n; i++) {
            int j = r.nextInt(n);
            int t = array[i];
            array[i] = array[j];
            array[j] = t;
        }
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zakhar Voit
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        out.println(solve(in.nextLong(), in.nextLong()));
        /*for (long l = 1; l < 500; l++) {
            for (long r = l; r < 500; r++) {
                if (badSolve(l, r) != solve(l, r)) {
                    out.println(l + " " + r);
                    return;
                }
            }
        }
        out.println("OK");*/
    }

    long solve(long l, long r) {
        if (l == r)
            return 0;
        long ans = l ^ (l + 1);

        for (int i = 0; i < 62; i++) {
            l |= (1l << i);
            if (l + 1 <= r)
                ans = (1l << (i + 2l)) - 1;
        }

        return ans;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    public String nextToken() {
        if (!tok.hasMoreTokens()) {
            try {
                String newLine = in.readLine();
                if (newLine == null)
                    throw new InputMismatchException();
                tok = new StringTokenizer(newLine);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            return nextToken();
        }

        return tok.nextToken();
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }

    }

import java.io.PrintWriter;
import java.util.Scanner;

public class D {

	public static void main(String [] args){
		Scanner cin = new Scanner(System.in);
		PrintWriter cout = new PrintWriter(System.out);
		long l = cin.nextLong(), r = cin.nextLong(), k = 1;
		if (l == r)cout.println(0);
		else {
			while (((r>>k)<<k)>l)k++;k--;
			cout.println(((r>>k)<<k)^(((r>>k)<<k)-1));
		}
		cout.flush();
	}

}

import java.util.*;
public class Main {
    public static void main(String args[]) {
     		Scanner scn = new Scanner(System.in);
		long x1 = scn.nextLong();
		long y1 = scn.nextLong();
		String x = Long.toBinaryString(x1);
		String y = Long.toBinaryString(y1);

		int len = x.length();

		for (int i=1; i<=(y.length()-len);i++){
				x = '0'+x;
		}
		int flag = 0;
		while ((flag< y.length()) && (x.charAt(flag)-48)==(y.charAt(flag)-48)){
			flag++;
		}
//		System.out.println(flag);
		long sum =0;
		for (int i =0; i<(y.length()-flag);i++){
			sum += (long)1<<i;
		}
		System.out.println(sum);
}

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Scanner;
/**
 *
 * @hor user
 */
public class gameD  {
   public static void main(String[] args) throws IOException {
    BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
  Scanner sc= new Scanner(System.in);
 long lo=sc.nextLong(),up=sc.nextLong();
  int[] A= new int[100];
  int[] B= new int[100];
     int len=0;
     while(up>0){
     A[len]=(int) (up%2);
     B[len]=(int) (lo%2);
     len++;
     up/=2;
     lo/=2;
     }
      // System.out.println(len);
     int i=0;
       for ( i = len-1; i >= 0; i--) {
           if(A[i]==1&&B[i]==0)break;
           if(i==0){
               System.out.println("0");
               return;
           }
       }
   long ans=(long) (pow(2, i+1)-1);
       System.out.println(ans);
   }
  static long pow(long a,long b){
   long ret=1;
       for (int i = 0; i < b; i++) {
           ret*=a;
       }
   return ret;
   }

}

import java.util.Scanner;

public class D276 {

	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		long a= in.nextLong();
		long b=in.nextLong();

		boolean f1=true;
		boolean f2=true;
		int c=-1;
		for( int i=63;i>=0;i--){
			boolean af= ((a & (1l<<i))!=0);
			boolean bf= (( b& ( 1l<<i)) !=0);

			if((af ^ bf) && f2){
				f2=false;
				System.out.println((1l<<(i+1))-1);
				break;
			}
			if( bf && !af  && f1){
				f1=false;
				System.out.println((1l<<(i+1))-1);
				break;
			}
		}
		if(f1 && f2){
			System.out.println(0);
		}

	}

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Artem_Mikhalevitch
 */
public class Main extends ASolver {

    long n;
    long k;

    public static void main(String[] args) {
        Main s = new Main();
        s.init();
        if (s.readData()) {
            s.writeData(s.solve());
        }

    }

    @Override
    public void init() {
        super.init();
    }

    @Override
    public boolean readData() {
        try {
            n = nextLong();
            k = nextLong();
        } catch (Exception ex) {
            System.out.println(ex.getCause());
            System.out.println(ex.getMessage());
            return false;
        }

        return true;
    }

    public double[] sort(double[] mas1, double[] mas2) {
        int l1 = mas1.length;
        int l2 = mas2.length;
        double[] result = new double[l1 + l2];
        int i1 = 0, i2 = 0;
        int i = 0;
        for (i = 0; i1 < l1 && i2 < l2; i++) {
            if (mas1[i1] <= mas2[i2]) {
                result[i] = mas1[i1++];
            } else {
                result[i] = mas2[i2++];
            }
        }
        for (int j = i; i1 < l1; j++) {
            result[j] = mas1[i1++];
        }
        for (int j = i; i2 < l2; j++) {
            result[j] = mas2[i2++];
        }
        return result;
    }

    public long solve() {
        if (n == k) {
            return 0;
        }
        int i = 62;
        for (i = 62; i > 0; i--) {
            //System.out.println(n & (1L << i));
            //System.out.println(k & (1L << i));
            if ((n & (1L << i)) != (k & (1L << i))) {
                break;
            }
        }
        return (1L << i + 1) - 1;
    }
}

abstract class ASolver {

    protected StringTokenizer tokens;
    protected BufferedReader input;
    protected PrintWriter output;

    public void init() {
        input = new BufferedReader(new InputStreamReader(System.in));
    }

    public abstract boolean readData();

    public void writeData(String result) {
        System.out.println(result);
    }

    public void writeData(int result) {
        System.out.println(result);
    }

    public void writeData(long result) {
        System.out.println(result);
    }

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

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

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

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

    public String nextLine() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine(), "\n");
        }
        return tokens.nextToken();
    }

    public long infinityImitator(long a, long b) {
        if (a == Long.MIN_VALUE) {
            return Long.MIN_VALUE;
        } else {
            return a + b;
        }
    }

    public int infinityImitator(int a, int b) {
        if (a == Integer.MIN_VALUE) {
            return Integer.MIN_VALUE;
        } else {
            return a + b;
        }
    }

    /*
     * public long max(long... a) { long result = Long.MIN_VALUE; for (int i =
     * 0; i < a.length; i++) { result = Math.max(result, a[i]); } return result;
     * }
     */
    public int indexMax(int... a) {
        int result = 0;
        int index = -1;
        int length = a.length;
        for (int i = 0; i < length; i++) {
            if (a[i] > result) {
                result = a[i];
                index = i;
            }
        }
        return index;
    }

    public int max(int... a) {
        int result = Integer.MIN_VALUE;
        for (int i = 0; i < a.length; i++) {
            result = Math.max(result, a[i]);
        }
        return result;
    }
}

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7
{
	static class Pair
	{
		int x;
		int y;
		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
	}
	static int mod=100000000;
	public static int[] sort(int[] a)
	{
		int n=a.length;
		ArrayList<Integer> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++)
		{
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++)
		{
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b)
    {
        long result=1;
        while(b>0)
        {
            if (b % 2 != 0)
            {
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }

    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b)
	{
		return a*(b/gcd(a,b));
	}
	static ArrayList<ArrayList<Integer>> graph;
	static public void main(String args[])throws IOException
	{
		int tt=1;
		StringBuilder sb1=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++)
		{
			long l=l();
			long r=l();
		/*	String s1=Long.toBinaryString(l);
			String s2=Long.toBinaryString(r);
			int rem=64-s1.length();
			for(int i=0;i<rem;i++)
				s1="0"+s1;
			rem=64-s2.length();
			for(int i=0;i<rem;i++)
				s2="0"+s2;
			char[] ch1=new char[64];
			char[] ch2=new char[64];
			for(int i=0;i<64;i++)
			{
				ch1[i]=s1.charAt(i);
				ch2[i]=s2.charAt(i);
			}
			int flag=0;
			int smaller=0;
			long ans=0;
			pln(s2);
			pln(s1);
			for(int i=0;i<64;i++)
			{
				if(ans>0)
				pln(ans+"");
				if(ch2[i]=='1' && flag==0)
				{
					flag=1;
					if(ch1[i]=='0')
					{
						ans=ans+pow(2,s2.length()-i-1);
						smaller=1;
					}
				}
				else
				{
					if(ch2[i]=='0' && ch1[i]=='1')
					{
						ans=ans+pow(2,s2.length()-i-1);
					}
					else if(ch2[i]=='1' && ch1[i]=='0')
					{
						ans=ans+pow(2,s2.length()-i-1);
						smaller=1;
					}
					else if(ch2[i]=='0' && ch1[i]=='0')
					{
						if(smaller==1)
						{
							ans=ans+pow(2,s2.length()-i-1);
							for(int j=i+1;j<64;j++)
								ch1[j]='0';
						}
					}
					else if(ch2[i]=='1' && ch1[i]=='1')
					{

					}
				}
			}*/
			long i=0;
			for( i=63;i>=0;i--)
			{
			  if((l&(1L<<i))!=(r&(1L<<i)))
			  break;
			}
			long ans=1;
			for(int p=0;p<=i;p++)
			{
			  ans=ans*2;
			}
			ans-=1;

			pln(ans+"");
		}
		System.out.print(sb1.toString());
	}
	/**/
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	public static long l()
	{
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value)
	{
		System.out.println(value);
	}
	public static int i()
	{
		return in.Int();
	}
	public static String s()
	{
		return in.String();
	}
}
	class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars== -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int Int() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String String() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return String();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object...objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object...objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}

		public void flush() {
			writer.flush();
		}

		}

		class IOUtils {

		public static int[] readIntArray(InputReader in, int size) {
			int[] array = new int[size];
			for (int i = 0; i < size; i++)
				array[i] = in.Int();
			return array;
		}

	}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.text.*;

public class cf276d {

    static BufferedReader br;
    static Scanner sc;
    static PrintWriter out;

    public static void initA() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            //br = new BufferedReader(new FileReader("input.txt"));
            sc = new Scanner(System.in);
            //out = new PrintWriter("output.txt");
            out = new PrintWriter(System.out);
        } catch (Exception e) {
        }
    }

    public static void initB() {
        try {

            br = new BufferedReader(new FileReader("input.txt"));
            sc = new Scanner(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");

        } catch (Exception e) {
        }
    }

    public static String getString() {
        try {
            return br.readLine();
        } catch (Exception e) {
        }
        return "";
    }

    public static Integer getInt() {
        try {
            return Integer.parseInt(br.readLine());
        } catch (Exception e) {
        }
        return 0;
    }

    public static Integer[] getIntArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Integer temp2[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Integer.parseInt(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static Long[] getLongArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Long temp2[] = new Long[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Long.parseLong(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static String[] getStringArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            String temp2[] = new String[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = (temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static int getMax(Integer[] ar) {
        int t = ar[0];
        for (int i = 0; i < ar.length; i++) {
            if (ar[i] > t) {
                t = ar[i];
            }
        }
        return t;
    }

    public static void print(Object a) {
        out.println(a);
    }

    public static int nextInt() {
        return sc.nextInt();
    }

    public static double nextDouble() {
        return sc.nextDouble();
    }

    public static void main(String[] ar) {
        initA();
        solve();
        out.flush();
    }
    public static void print2(Object o){System.out.println(o);}

    public static void solve() {
        Long xx[] = getLongArr();
        long l = xx[0];
        long r = xx[1];
        BigInteger a = BigInteger.valueOf(l);
        BigInteger b = BigInteger.valueOf(r);

        if(l==r){
            print(0);return;
        }

        String a2 = a.toString(2);
        String b2 = b.toString(2);

        int selisihpjg = Math.abs(a2.length() - b2.length());

        while (selisihpjg-- > 0) {
            a2 = "0" + a2;
            //print2("wewe");
        }

        //print2(a2);
        //print2(b2);
        String out = "";

        for (int i = 0; i < b2.length(); i++) {
            //print2("i="+i);
            if (a2.charAt(i) != b2.charAt(i)) {

                for (int ii = i; ii < b2.length(); ii++) {
                    out += "1";
                }
                //print2(out);
                print2(new BigInteger(out, 2));
                return;
            }
        }

    }
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nguyen Trung Hieu - vuondenthanhcong11@gmail.com
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long from = in.readLong();
        long to = in.readLong();

        String strFrom = Long.toBinaryString(from);
        String strTo = Long.toBinaryString(to);

        while (strFrom.length() < strTo.length())
            strFrom = "0" + strFrom;

        for (int i = 0; i < strFrom.length(); i++) {
            if (strFrom.charAt(i) == '0' && strTo.charAt(i) == '1') {
                out.printLine((1L << (strFrom.length() - i)) - 1);
                return;
            }
        }

        out.printLine(0);
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}

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

public class Main{
   	static void main() throws Exception{
   		long l=sc.nextLong(),r=sc.nextLong();
   		if(l==r) {
   			pw.println(0);
   			return;
   		}
   		long dif=r-l;
   		long ans=0;
   		for(int bit=62;bit>=0;bit--) {
   			if(dif>=(1l<<bit)) {
   				ans|=(1l<<bit);
   			}
   			else {
   				long bit1=((l>>bit)&1);
   				long bit2=((r>>bit)&1);
   				if(bit1!=bit2) {
   					ans|=(1l<<bit);
   				}
   			}
   		}
   		pw.println(ans);
	}
	public static void main(String[] args) throws Exception{
		pw=new PrintWriter(System.out);
		sc = new MScanner(System.in);
		int tc=1;
		while(tc-->0)main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

import java.util.Scanner;

public class D {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String l = Long.toBinaryString(in.nextLong());
        String h = Long.toBinaryString(in.nextLong());
        int dis=h.length()-l.length();
        for (int i = 0; i < dis; i++) {
            l = "0" + l;
        }
        char[] low = l.toCharArray();
        char[] high = h.toCharArray();
        int i;
        for (i = 0; i < high.length; i++) {
            if (high[i] > low[i]) {
                break;
            }
        }
        i++;
        for (; i < high.length; i++) {
            if (high[i] == '0') {
                low[i] = '1';
            }
            else if(low[i]=='1'){
                high[i]='0';
            }

        }
        String ans1 = "";
        for (int j = 0; j < high.length; j++) {
            ans1 = ans1 + high[j];
        }
        String ans2 = "";
        for (int j = 0; j < high.length; j++) {
            ans2 = ans2 + low[j];
        }
        System.out.println(Long.parseLong(ans1, 2) ^ Long.parseLong(ans2, 2));
    }
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author roosephu
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        long l = in.nextLong(), r = in.nextLong();

        long ans = 0;
        for (int i = 0; i <= 60; ++i) {
            if ((l >> i & 1) != (r >> i & 1)) {
                ans = (2l << i) - 1;
            }
        }
        out.println(ans);
    }
}

import java.io.*;
import java.lang.reflect.*;

public class D {

	final int MOD = (int)1e9 + 7;
	final double eps = 1e-12;
	final int INF = (int)1e9;

	public D () {
		long L = sc.nextLong();
		long R = sc.nextLong();

		for (int i = 60; i >= 0; --i) {
			long b = (1L << i);
			long A = (L & b), B = (R & b);
			if (A != B)
				exit(2*b-1);
		}
		exit(0);
	}

	////////////////////////////////////////////////////////////////////////////////////

	/* Dear hacker, don't bother reading below this line, unless you want to help me debug my I/O routines :-) */

	static MyScanner sc = new MyScanner();

	static class MyScanner {
		public String next() {
			newLine();
			return line[index++];
		}

		public char nextChar() {
			return next().charAt(0);
		}

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

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

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

		public String nextLine() {
			line = null;
			return readLine();
		}

		public String [] nextStrings() {
			line = null;
			return readLine().split(" ");
		}

		public char [] nextChars() {
			return next().toCharArray();
		}

		public Integer [] nextInts() {
			String [] L = nextStrings();
			Integer [] res = new Integer [L.length];
			for (int i = 0; i < L.length; ++i)
				res[i] = Integer.parseInt(L[i]);
			return res;
		}

		public Long [] nextLongs() {
			String [] L = nextStrings();
			Long [] res = new Long [L.length];
			for (int i = 0; i < L.length; ++i)
				res[i] = Long.parseLong(L[i]);
			return res;
		}

		public Double [] nextDoubles() {
			String [] L = nextStrings();
			Double [] res = new Double [L.length];
			for (int i = 0; i < L.length; ++i)
				res[i] = Double.parseDouble(L[i]);
			return res;
		}

		public String [] next (int N) {
			String [] res = new String [N];
			for (int i = 0; i < N; ++i)
				res[i] = sc.next();
			return res;
		}

		public Integer [] nextInt (int N) {
			Integer [] res = new Integer [N];
			for (int i = 0; i < N; ++i)
				res[i] = sc.nextInt();
			return res;
		}

		public Long [] nextLong (int N) {
			Long [] res = new Long [N];
			for (int i = 0; i < N; ++i)
				res[i] = sc.nextLong();
			return res;
		}

		public Double [] nextDouble (int N) {
			Double [] res = new Double [N];
			for (int i = 0; i < N; ++i)
				res[i] = sc.nextDouble();
			return res;
		}

		public String [][] nextStrings (int N) {
			String [][] res = new String [N][];
			for (int i = 0; i < N; ++i)
				res[i] = sc.nextStrings();
			return res;
		}

		public Integer [][] nextInts (int N) {
			Integer [][] res = new Integer [N][];
			for (int i = 0; i < N; ++i)
				res[i] = sc.nextInts();
			return res;
		}

		public Long [][] nextLongs (int N) {
			Long [][] res = new Long [N][];
			for (int i = 0; i < N; ++i)
				res[i] = sc.nextLongs();
			return res;
		}

		public Double [][] nextDoubles (int N) {
			Double [][] res = new Double [N][];
			for (int i = 0; i < N; ++i)
				res[i] = sc.nextDoubles();
			return res;
		}

		//////////////////////////////////////////////

		private boolean eol() {
			return index == line.length;
		}

		private String readLine() {
			try {
				return r.readLine();
			} catch (Exception e) {
				throw new Error(e);
			}
		}
		private final BufferedReader r;

		MyScanner () {
			this(new BufferedReader(new InputStreamReader(System.in)));
		}

		MyScanner(BufferedReader r) {
			try {
				this.r = r;
				while (!r.ready())
					Thread.sleep(1);
				start();
			} catch (Exception e) {
				throw new Error(e);
			}
		}

		private String [] line;
		private int index;

		private void newLine() {
			if (line == null || eol()) {
				line = readLine().split(" ");
				index = 0;
			}
		}
	}

	static void print(Object o, Object... a) {
		printDelim(" ", o, a);
	}

	static void cprint(Object o, Object... a) {
		printDelim("", o, a);
	}

	static void printDelim (String delim, Object o, Object... a) {
		pw.println(build(delim, o, a));
	}

	static void exit (Object o, Object... a) {
		print(o, a);
		exit();
	}

	static void exit () {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}

	void NO() {
		throw new Error("NO!");
	}

	////////////////////////////////////////////////////////////////////////////////////

	static String build(String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.toString().trim();
	}

	static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = Array.getLength(o);
			for (int i = 0; i < L; ++i)
				append(b, Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>) {
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		} else
			b.append(delim).append(o);
	}

	////////////////////////////////////////////////////////////////////////////////////

	public static void main(String[] args) {
		new D();
		exit();
	}

	static void start() {
		t = millis();
	}

	static PrintWriter pw = new PrintWriter(System.out);

	static long t;

	static long millis() {
		return System.currentTimeMillis();
	}
}

import java.io.PrintWriter;
import java.util.Scanner;

public class D276 {

    public static void main(String[] args) {
        try (Scanner reader = new Scanner(System.in); PrintWriter writer = new PrintWriter(System.out)) {
            long l = reader.nextLong();
            long r = reader.nextLong();
            long result = 0;

            int i = 63;
            for (; i >= 0; i -= 1) {
                long v = 1L << i;
                if ((r & v) != 0 && !((r & v) == (l & v))) break;
            }
            boolean prevCredit = false;
            for (; i >= 0; i -= 1) {
                long v = 1L << i;
                if ((r & v) != (l & v)) {
                    result <<= 1;
                    result |= 1;
                    prevCredit = true;
                } else {
                    if ((r & v) == 0) {
                        result <<= 1;
                        result |= 1;
                        prevCredit = true;
                    } else {
                        if (!prevCredit) {
                            result <<= 1;
                            result |= 0;
                            prevCredit = false;
                        } else {
                            result <<= 1;
                            result |= 1;
                            prevCredit = true;
                        }
                    }
                }
            }

            writer.println(result);
        }
    }

}

import java.util.Arrays;
import java.util.Scanner;

public class LittleGirlandMaximumXOR {
    static int[] L;
    static int[] R;
    private static long[][][][][] dp;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        String ll = Long.toBinaryString(l);
        String rr = Long.toBinaryString(r);
        L = new int[64];
        R = new int[64];
        int index = L.length-1;
        for (int i = ll.length()-1; i >= 0; i--)
            L[index--] = ll.charAt(i)-'0';

        index = L.length-1;
        for (int i = rr.length()-1; i >= 0; i--)
            R[index--] = rr.charAt(i)-'0';

        dp = new long[2][2][2][2][64];
        for (int i = 0; i < dp.length; i++)
            for (int j = 0; j < dp[0].length; j++)
                for (int k = 0; k < dp[0][0].length; k++)
                    for (int m = 0; m < dp[0][0][0].length; m++)
                        Arrays.fill(dp[i][j][k][m], -1);
        long ans = go(0, 0, 0, 0, 0);
        System.out.println(ans);
    }

    private static long go(int f1, int f2, int f3, int f4, int index) {
        if (index == L.length)
            return 0;
        else if (dp[f1][f2][f3][f4][index] != -1)
            return dp[f1][f2][f3][f4][index];
        else {
            long max = 0;
            for (int i = 0; i < 2; i++)
                for (int j = 0; j < 2; j++) {
                    int newF1 = f1;
                    int newF2 = f2;
                    int newF3 = f3;
                    int newF4 = f4;
                    if (f1 == 0) {
                        if (i < L[index])
                            continue;
                        if (i > L[index])
                            newF1 = 1;
                    }
                    if (f2 == 0) {
                        if (i > R[index])
                            continue;
                        if (i < R[index])
                            newF2 = 1;
                    }
                    if (f3 == 0) {
                        if (j < L[index])
                            continue;
                        if (j > L[index])
                            newF3 = 1;
                    }
                    if (f4 == 0) {
                        if (j > R[index])
                            continue;
                        if (j < R[index])
                            newF4 = 1;
                    }
                    max = Math
                            .max(max,
                                    go(newF1, newF2, newF3, newF4, index + 1)
                                            + (i ^ j)
                                            * (long) (Math.pow(2, L.length
                                                    - index - 1)));
                }
            return dp[f1][f2][f3][f4][index] = max;
        }
    }
}

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

 public class spoj {

	InputStream is;
	static PrintWriter out;

	static long hasBit(long l,int pos)
	{
		return (l&(1L<<pos));
	}

    void solve()
    {
		long l=nl(),r=nl();
		int bit=62;

		if(l==r){
			out.println(0);
		return;}

		while(bit!=0 && hasBit(l,bit)==hasBit(r,bit))
			bit--;

		out.println(((1L<<(bit+1))-1));

    }

    //---------- I/O Template ----------

    public static void main(String[] args) { new spoj().run(); }
    void run() {
        is = System.in;
        out = new PrintWriter(System.out);
        solve();
        out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte() {
        if(ptr >= len) { ptr = 0;
            try { len = is.read(input); }
            catch(IOException e) { throw new InputMismatchException(); }
            if(len <= 0) { return -1; }
        } return input[ptr++];
    }
    boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
    int skip() {
        int b = readByte();
        while(b != -1 && isSpaceChar(b)) { b = readByte(); }
        return b;
    }

    char nc() { return (char)skip(); }
    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    String nLine() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    int ni() {
        int n = 0, b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        if(b == -1) { return -1; }  //no input
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }
    long nl() {
        long n = 0L;    int b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }

    double nd() { return Double.parseDouble(ns()); }
    float nf() { return Float.parseFloat(ns()); }
    int[] na(int n) {
        int a[] = new int[n];
        for(int i = 0; i < n; i++) { a[i] = ni(); }
        return a;
    }
    char[] ns(int n) {
        char c[] = new char[n];
        int i, b = skip();
        for(i = 0; i < n; i++) {
            if(isSpaceChar(b)) { break; }
            c[i] = (char)b; b = readByte();
        } return i == n ? c : Arrays.copyOf(c,i);
    }
	static void pa(int a[])
	{
		for(int i=0;i<a.length;i++)
		out.print(a[i]+" ");
		out.println();
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

	public void solve() throws IOException {
		out.println( Math.max(0, Long.highestOneBit(nextLong() ^ nextLong()) * 2 - 1) );
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new D().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

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

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

}

/**
 * Created with IntelliJ IDEA.
 * User: brzezinsky
 * Date: 12/16/12
 * Time: 7:44 PM
 * To change this template use File | Settings | File Templates.
 */

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

public class E extends Thread {
    public E(String inputFileName, String outputFileName) {
        try {
            if (inputFileName != null) {
                this.input = new BufferedReader(new FileReader(inputFileName));
            } else {
                this.input = new BufferedReader(new InputStreamReader(System.in));
            }
            if (outputFileName != null) {
                this.output = new PrintWriter(outputFileName);
            } else {
                this.output = new PrintWriter(System.out);
            }
            this.setPriority(Thread.MAX_PRIORITY);
        } catch (Throwable e) {
            System.err.println(e.getMessage());
            e.printStackTrace();
            System.exit(666);
        }
    }

    private void solve() throws Throwable {
        long l = nextLong(), r = nextLong();
        output.println(Math.max(Long.highestOneBit(l ^ r) * 2 - 1, 0L));
    }

    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            System.err.println(e.getMessage());
            e.printStackTrace();
            System.exit(666);
        } finally {
            output.close();
        }
    }

    public static void main(String... args) {
        new E(null, null).start();
    }

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

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

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

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

    private StringTokenizer tokens;
    private BufferedReader input;
    private PrintWriter output;
}

import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);

		long a=s.nextLong();
		long b=s.nextLong();

		if(a<b)
		{
			long temp=a;
			a=b;
			b=temp;
		}

		String str1=Long.toBinaryString(a);
		String str2=Long.toBinaryString(b);

		int count=0;

		if(str1.length()>str2.length())
		{
			count=str1.length();
		}
		else
		{
			for(int i=0;i<str1.length();i++)
			{
				if(str1.charAt(i)!=str2.charAt(i))
				{
					count=str1.length()-i;
					break;
				}
			}
		}

		System.out.println((long)Math.pow(2,count)-1);

	}

}

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

public class Main {

    FastScanner in;
    PrintWriter out;

    static class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

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

        String nextLine() throws IOException {
            if (st == null || !st.hasMoreTokens())
                return br.readLine();
            StringBuilder result = new StringBuilder(st.nextToken());
            while (st.hasMoreTokens()) {
                result.append(" ");
                result.append(st.nextToken());
            }
            return result.toString();
        }

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

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

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

    }

    void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out, false);
        solve();
        out.close();
    }

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

    public void printArr(int[] arr){
        for(int i = 0; i < arr.length; i++){
            out.print(arr[i] + " ");
        }
        out.println();
    }

    public long gcd(long a, long b){
        if(a == 0) return b;
        return gcd(b % a, a);
    }

    public boolean isPrime(long num){

        if(num == 0 || num == 1){
            return false;
        }

        for(int i = 2; i * i <= num; i++){
            if(num % i == 0){
                return false;
            }
        }

        return true;
    }

    class Pair{
        int x; int y;
        Pair(int ix, int iy){
            x = ix;
            y = iy;
        }
    }

    class Tuple{
        int x; int y; int z;
        Tuple(int ix, int iy, int iz){
            x = ix;
            y = iy;
            z = iz;
        }
    }

    public void solve() throws IOException{

        long l = in.nextLong();
        long r = in.nextLong();

        long diff = r - l;
        long res = 0L;
        long pos = 0L;

        while(diff >= (1L << pos)){
            res += (1L << pos);
            pos++;
        }

        while((1L << pos) <= r){

            if((((l >> pos) ^ (r >> pos)) & 1L) == 1L){
                res += (1L << pos);
            }
            pos++;
        }

        out.println(res);

        return;
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class LittleGirlAndXor {
    static long L, R;
    static Long[][][][][] dp = new Long[64][2][2][2][2];
    public static long go(int index, int low1, int high1, int low2, int high2) {
        if (index == -1) {
            return 0;
        }
        if (dp[index][low1][high1][low2][high2] != null)
            return dp[index][low1][high1][low2][high2];
        int bit1 = (L & (1L << index)) == 0 ? 0 : 1;
        int bit2 = (R & (1L << index)) == 0 ? 0 : 1;
        long res = 0;
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                int nl1 = low1, nh1 = high1, nl2 = low2, nh2 = high2;
                boolean can = true;
                if (low1 == 0) {
                    if (i == bit1) {
                        nl1 = 0;
                    } else if (i < bit1) {
                        can = false;
                    } else if (i > bit1) {
                        nl1 = 1;
                    }
                }
                if (high1 == 0) {
                    if (i == bit2) {
                        nh1 = 0;
                    } else if (i < bit2) {
                        nh1 = 1;
                    } else if (i > bit2) {
                        can = false;
                    }
                }
                if (low2 == 0) {
                    if (j == bit1) {
                        nl2 = 0;
                    } else if (j < bit1) {
                        can = false;
                    } else if (j > bit1) {
                        nl2 = 1;
                    }
                }
                if (high2 == 0) {
                    if (j == bit2) {
                        nh2 = 0;
                    } else if (j < bit2) {
                        nh2 = 1;
                    } else if (j > bit2) {
                        can = false;
                    }
                }
                if (can){
                    long xor = i^j;
                    res = Math.max(res, (xor<<index)+go(index - 1, nl1, nh1, nl2, nh2));
                }
            }
        }
        return dp[index][low1][high1][low2][high2] = res;
    }
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        L = r.nextLong();
        R = r.nextLong();
        System.out.println(go(63,0,0,0,0));
    }
    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

import java.util.*;
import java.io.*;
//import java.lang.*;

public class ranjan{

    public static Read cin;
    //public static InputReader cin;
    public static PrintWriter cout;
    public static boolean[] visited;
    public static final long b = (long)1e9+7;
    public static int fileread = 0;

    public static void main(String ...arg) throws IOException
    {
        /*console writer*/
        cout = new PrintWriter(new BufferedOutputStream(System.out));
        /*Debug Reader*/
        //Scan cin =new Scan();
        if(fileread == 1)
        {
            try
            {
            cin = new Read(new FileInputStream(new File("in2.txt")));
            //cin = new InputReader(new FileInputStream(new File("in1.txt")));
            }
            catch (IOException error){}
        }
        else{
            cin = new Read(System.in);
            //cin = new InputReader(System.in);
        }

        long l = cin.nextLong();
    	long r = cin.nextLong();
        long i = (long)Math.ceil((Math.log(r-l)/Math.log(2)));
        l = l>>i;
        r = r>>i;
        cout.print( ((l^r)<<i) + ((1L*1<<i)-1)  );
        cout.close();
    }

    public static long mod_pow(long x,long n,long mod) {
		long res=1;
		while(n>0) {
			if((n&1)==1)res=res*x%mod;
			x=x*x%mod;
			n>>=1;
		}
		return res;
    }
    public static long gcd(long n1, long n2)
	{
		long r;
		while (n2 != 0)
		{
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2)
	{
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

    static class InputReader {
        final InputStream is;
        final byte[] buf = new byte[1024];
        int pos;
        int size;

        public InputReader(InputStream is) {
            this.is = is;
        }

        public int nextInt() {
            int c = read();
            while (isWhitespace(c))
                c = read();
            int sign = 1;
            if (c == '-') {
                sign = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res = res * 10 + c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sign;
        }

        int read() {
            if (size == -1)
                throw new InputMismatchException();
            if (pos >= size) {
                pos = 0;
                try {
                    size = is.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (size <= 0)
                    return -1;
            }
            return buf[pos++] & 255;
        }

        static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

static class RecursionLimiter {
    public static long maxLevel = 1549;

    public static void emerge() {
        if (maxLevel == 0)
            return;
        try {
            throw new IllegalStateException("Too deep, emerging");
        } catch (IllegalStateException e) {
            if (e.getStackTrace().length > maxLevel + 1)
                throw e;
        }
    }
}

static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }

}

class Read
{
    private BufferedReader br;
    private StringTokenizer st;

    public Read(InputStream is)
    { br = new BufferedReader(new InputStreamReader(is)); }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try {st = new StringTokenizer(br.readLine());}
            catch(IOException e)
                {e.printStackTrace();}
        }
        return st.nextToken();
    }

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

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

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

    String nextLine()
    {
        String str = "";
        try {str = br.readLine();}
        catch(IOException e)
            {e.printStackTrace();}
        return str;
    }
}

import java.util.*;
import java.math.*;
public class Main
{
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
	    long n=scan.nextLong();
	    long m=scan.nextLong();
	    long xor=n^m;
	    long cnt=1;
	    while(xor>0){
	        xor>>=1;
	        cnt<<=1;
	    }
	    cnt--;
	    System.out.println(cnt);
	}
}

//Little Girl and Maximum XOR
import java.io.*;
import java.util.*;
import java.lang.*;

public class D276{

   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);

      StringTokenizer st = new StringTokenizer(f.readLine());

      long n = Long.parseLong(st.nextToken());                //n is lower
      long m = Long.parseLong(st.nextToken());                //m is upper
      long lower = n;
      long upper = m;

      String nb = Long.toBinaryString(n);
      String mb = Long.toBinaryString(m);
      int len = mb.length();

      String add0 = "";
      for(int k = nb.length(); k < len; k++) add0+="0";

      nb = add0 + nb;

      long answer = 0L;
      // int index = 0;
//       while(index<len && nb.charAt(index) == '1' && mb.charAt(index) == '1'){
//          index++;
//          answer+=(long)Math.pow(2,len-index-1);
//       }

      for(int k = 0; k < len; k++){
         char a = mb.charAt(k);                       //a is upper
         char b = nb.charAt(k);                       //b is lower

         long i = (long)Math.pow(2,len-k-1);
         if(a!=b) answer+=i;

         if(a=='0' && b=='0'){
            if(lower+i<=m){
               lower+=i;                              //change 0 to 1 on lower
               answer+=i;
            }
         }
         if(a=='1' && b=='1'){
            if(upper-i>=n){
               upper-=i;                              //change 1 to 0 on upper
               answer+=i;
            }
         }
      }

      out.println(answer);

      out.close();
   }

}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R169_Div2_D //Name: Little Girl and Maximum XOR
{
	FastReader in;
	PrintWriter out;

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

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		long l = in.nextLong();
		long r = in.nextLong();

        if (l == r)
        	out.println(0); // l ^ r
        else
        {
            long num = 0;
            for (int i = 62; i >= 0; i--)
            {
                long num1 = 1L << i;
                while (num + num1 > r) num1 /= 2;
                num += num1;
                if (num - 1 >= l) break;
            }

            // (num - 1 >= l)
            out.println(num ^ (num - 1));
        }
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

//All CopyRights reserved GeeksforGeeks.com
//Under the fair use(free use) Copyrights exception;
//some codes are copied.
import java.io.*;
import java.util.*;
import javax.xml.stream.events.Characters;
public class Main {
	public static void main(String[] args)throws IOException {
		//the problem is about inscribt cirlces
		    BufferedReader BR=new BufferedReader(new InputStreamReader(System.in));
	        PrintWriter PW=new PrintWriter(new PrintStream(System.out));
	        In IN=new In(BR);
	        Out OUT=new Out(PW);
	        Scanner SC=new Scanner(System.in);
	        //DataStructure DS=new DataStructure();
	        //Functions F=new Functions();
	        //QuickSort QS=new QuickSort();
	        //BinarySearch BS=new BinarySearch();
	        //FIB fubbonanci=new FIB(93);
            long l = IN.nextLong();
	    	long r = IN.nextLong();
	    	long t=0;
	    	if(r==l) {System.out.println(0);}
	    	else {

	    		boolean check=false;
	    		for (int i = 62; i >= 0; --i) {
		    		if ((l&(1L<<i)) != (r&(1L<<i)))  check= true;
		    		if (check) t |= 1L<<i;
		    	}
	    		System.out.println(t);
	    	}
	}
	      protected static class In {
	        private BufferedReader reader;
	        private StringTokenizer tokenizer = new StringTokenizer("");
	        public In(BufferedReader reader) {
	            this.reader = reader;
	        }

	        public String next() throws IOException {
	            while (!tokenizer.hasMoreTokens())
	                tokenizer = new StringTokenizer(reader.readLine());
	            return tokenizer.nextToken();
	        }

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

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

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

	        public int[] nextIntArray(int n) throws IOException {
	            int[] a = new int[n];
	            for (int i = 0; i < n; i++)
	                a[i] = nextInt();
	            return a;
	        }

	        public int[] nextIntArray1(int n) throws IOException {
	            int[] a = new int[n + 1];
	            for (int i = 1; i <= n; i++)
	                a[i] = nextInt();
	            return a;
	        }

	        public int[] nextIntArraySorted(int n) throws IOException {
	            int[] a = nextIntArray(n);
	            Random r = new Random();
	            for (int i = 0; i < n; i++) {
	                int j = i + r.nextInt(n - i);
	                int t = a[i];
	                a[i] = a[j];
	                a[j] = t;
	            }
	            Arrays.sort(a);
	            return a;
	        }

	        public long[] nextLongArray(int n) throws IOException {
	            long[] a = new long[n];
	            for (int i = 0; i < n; i++)
	                a[i] = nextLong();
	            return a;
	        }

	        public long[] nextLongArray1(int n) throws IOException {
	            long[] a = new long[n + 1];
	            for (int i = 1; i <= n; i++)
	                a[i] = nextLong();
	            return a;
	        }

	        public long[] nextLongArraySorted(int n) throws IOException {
	            long[] a = nextLongArray(n);
	            Random r = new Random();
	            for (int i = 0; i < n; i++) {
	                int j = i + r.nextInt(n - i);
	                long t = a[i];
	                a[i] = a[j];
	                a[j] = t;
	            }
	            Arrays.sort(a);
	            return a;
	        }
	    }
	    protected static class Out {
	        private PrintWriter writer;
	        private static boolean local = System
	                .getProperty("ONLINE_JUDGE") == null;

	        public Out(PrintWriter writer) {
	            this.writer = writer;
	        }

	        public void print(char c) {
	            writer.print(c);
	        }

	        public void print(int a) {
	            writer.print(a);
	        }

	        public void println(Object a) {
	            writer.println(a);
	        }

	        public void println(Object[] os) {
	            for (int i = 0; i < os.length; i++) {
	                writer.print(os[i]);
	                writer.print(' ');
	            }
	            writer.println();
	        }

	        public void println(int[] a) {
	            for (int i = 0; i < a.length; i++) {
	                writer.print(a[i]);
	                writer.print(' ');
	            }
	            writer.println();
	        }

	        public void println(long[] a) {
	            for (int i = 0; i < a.length; i++) {
	                writer.print(a[i]);
	                writer.print(' ');
	            }
	            writer.println();
	        }

	        public static void db(Object... objects) {
	            if (local)
	                System.out.println(Arrays.deepToString(objects));
	        }
	    }
	    public static class QuickSort{
	    protected static int [] intArray;
	    protected static long [] longArray;
	    protected static double [] DoubleArray;
	    protected static char [] charArray;
	    protected static int Size;
	        public QuickSort() {
	        }

	    protected static int partition(int arr[],int low,int high)
	    {
	      int pivot=arr[high];
	      int i=low-1;
	      int temp=0;
	        for (int j = low; j < high; ++j) {
	            if(arr[j]<=pivot)
	            {
	                 ++i;
	                 temp = arr[i];
	                 arr[i] = arr[j];
	                 arr[j] = temp;
	            }
	        }
	         temp = arr[i+1];
	         arr[i+1] = arr[high];
	         arr[high] = temp;
	         return i+1;

	    }
	    protected static int partition(long arr[],int low,int high)
	    {
	      long pivot=arr[high];
	      int i=low-1;
	      long temp=0;
	        for (int j = low; j < high; ++j) {
	            if(arr[j]<=pivot)
	            {
	                 ++i;
	                 temp = arr[i];
	                 arr[i] = arr[j];
	                 arr[j] = temp;
	            }
	        }
	         temp = arr[i+1];
	         arr[i+1] = arr[high];
	         arr[high] = temp;
	         return i+1;

	    }
	    protected static int partition(double arr[],int low,int high)
	    {
	      double pivot=arr[high];
	      int i=low-1;
	      double temp=0;
	        for (int j = low; j < high; ++j) {
	            if(arr[j]<=pivot)
	            {
	                 ++i;
	                 temp = arr[i];
	                 arr[i] = arr[j];
	                 arr[j] = temp;
	            }
	        }
	         temp = arr[i+1];
	         arr[i+1] = arr[high];
	         arr[high] = temp;
	         return i+1;

	    }
	    protected static int partition(char arr[],int low,int high)
	    {
	      char pivot=arr[high];
	      int i=low-1;
	      char temp=0;
	        for (int j = low; j < high; ++j) {
	            if(arr[j]<=pivot)
	            {
	                 ++i;
	                 temp = arr[i];
	                 arr[i] = arr[j];
	                 arr[j] = temp;
	            }
	        }
	         temp = arr[i+1];
	         arr[i+1] = arr[high];
	         arr[high] = temp;
	         return i+1;

	    }
	    protected static void sort(int arr[],int low, int high)
	    {
	          if(low < high)
	          {
	              int pi=partition(arr, low, high);
	              sort(arr, low, pi-1);
	              sort(arr, pi+1, high);

	          }

	    }
	   protected static void sort(long arr[],int low, int high)
	    {
	          if(low < high)
	          {
	              int pi=partition(arr, low, high);
	              sort(arr, low, pi-1);
	              sort(arr, pi+1, high);

	          }
	    }

	    protected static void sort(double arr[],int low, int high)
	    {
	          if(low < high)
	          {
	              int pi=partition(arr, low, high);
	              sort(arr, low, pi-1);
	              sort(arr, pi+1, high);

	          }
	    }
	    protected static void sort(char arr[],int low, int high)
	    {
	          if(low < high)
	          {
	              int pi=partition(arr, low, high);
	              sort(arr, low, pi-1);
	              sort(arr, pi+1, high);

	          }
	    }
	    protected  static void printArray(int arr[])
	    {
	        int n = arr.length;
	        for (int i=0; i<n; ++i)
	            System.out.print(arr[i]+" ");
	        System.out.println();
	    }
	    protected  static void printArray(char arr[])
	    {
	        int n = arr.length;
	        for (int i=0; i<n; ++i)
	            System.out.print(arr[i]+" ");
	        System.out.println();
	    }
	    protected  static void printArray(double arr[])
	    {
	        int n = arr.length;
	        for (int i=0; i<n; ++i)
	            System.out.print(arr[i]+" ");
	        System.out.println();
	    }
	     protected  static void printArray(long arr[])
	    {
	        int n = arr.length;
	        for (int i=0; i<n; ++i)
	            System.out.print(arr[i]+" ");
	        System.out.println();
	    }
	  }
	    public static class Functions{

	        public Functions() {
	        }
	        protected static boolean [] sieveOfEratosthenesPrimes(int limit){
	        boolean prime[] = new boolean[limit+1];
	        for(int i=0;i<limit;i++)
	            prime[i] = true;
	        for(int p = 2; p*p <=limit; p++)
	        {
	            // If prime[p] is not changed, then it is a prime
	            if(prime[p] == true)
	            {
	                // Update all multiples of p
	                for(int i = p*2; i <= limit; i += p)
	                    prime[i] = false;
	            }
	        }
	         return prime;
	    }
	    protected static boolean checkAnagram(String str1, String str2) {
	        int i=0;
	        for (char c : str1.toCharArray()) {
	        i = str2.indexOf(c, i) + 1;
	        if (i <= 0) { return false; }
	    }
	    return true;
	    }
	    protected static boolean contains(final int[] arr, final int key) {
	    return Arrays.stream(arr).anyMatch(i -> i == key);
	    }
	    public static boolean contains(final long[] arr, final long key) {
	    return Arrays.stream(arr).anyMatch(i -> i == key);
	    }
	    public static boolean contains(final double[] arr, final double key) {
	    return Arrays.stream(arr).anyMatch(i -> i == key);
	    }
	    protected static long NCR(long N, long R){
	    if(N < R)
	        return 0;
	    if(R == 0 || R == N)
	        return 1;
	    return NCR(N-1,R-1)+NCR(N-1,R);
	    }
	    protected static long NCR(int N, int R){
	    if(N < R)
	        return 0;
	    if(R == 0 || R == N)
	        return 1;
	    return NCR(N-1,R-1)+NCR(N-1,R);
	    }
	    protected static String changeCharInPosition(int position, char ch, String str){
	    char[] charArray = str.toCharArray();
	    charArray[position] = ch;
	    return new String(charArray);
	    }
	    protected static boolean isPrime(long n) {
	    if(n < 2) return false;
	    if(n == 2 || n == 3) return true;
	    if(n%2 == 0 || n%3 == 0) return false;
	    long sqrtN = (long)Math.sqrt(n)+1;
	    for(long i = 6L; i <= sqrtN; i += 6) {
	        if(n%(i-1) == 0 || n%(i+1) == 0) return false;
	    }
	    return true;
	    }
	    protected static long Gcd(long p, long q) {
	        if (q == 0) return p;
	        else return Gcd(q, p % q);
	     }
	    protected static boolean isPrime(int n) {
	    if(n < 2) return false;
	    if(n == 2 || n == 3) return true;
	    if(n%2 == 0 || n%3 == 0) return false;
	    int sqrtN = (int)Math.sqrt(n)+1;
	    for(long i = 6L; i <= sqrtN; i += 6) {
	        if(n%(i-1) == 0 || n%(i+1) == 0) return false;
	    }
	    return true;
	    }
	 }
	  public static class BinarySearch{
	        private static int middle;
	        private static int L;
	        private static int R;
	        public BinarySearch() {

	        }
	        protected static int Search(int [] arr,int element){
	         R=arr.length-1;
	         L=0;
	         return BS(arr, L, R, element);
	        }
	        protected static int Search(long [] arr,long element){
	         R=arr.length-1;
	         L=0;
	         return BS(arr, L, R, element);
	        }
	        protected static int Search(char [] arr,char element){
	         R=arr.length-1;
	         L=0;
	         return BS(arr, L, R, element);
	        }
	        protected static int Search(double [] arr,double element){
	         R=arr.length-1;
	         L=0;
	         return BS(arr, L, R, element);
	        }
	         protected static int BS(int [] arr,int L,int R,int element){
	          if(R>=L)
	          {
	            middle=L+(R-L)/2;
	            if(arr[middle]==element)
	            {
	                return middle;
	            }
	            else if(arr[middle]>element)
	            {
	                return BS(arr, L,middle-1, element);
	            }
	            else
	            {
	                return BS(arr, middle+1, R, element);
	            }
	          }
	          else
	            {
	              return -1;
	            }
	          }
	         protected static int BS(long [] arr,int L,int R,long element){
	          if(R>=L)
	          {
	            middle=L+(R-L)/2;
	            if(arr[middle]==element)
	            {
	                return middle;
	            }
	            else if(arr[middle]>element)
	            {
	                return BS(arr, L,middle-1, element);
	            }
	            else
	            {
	                return BS(arr, middle+1, R, element);
	            }
	          }
	          else
	            {
	              return -1;
	            }
	          }
	         protected static int BS(char [] arr,int L,int R,char element){
	          if(R>=L)
	          {
	            middle=L+(R-L)/2;
	            if(arr[middle]==element)
	            {
	                return middle;
	            }
	            else if(arr[middle]>element)
	            {
	                return BS(arr, L,middle-1, element);
	            }
	            else
	            {
	                return BS(arr, middle+1, R, element);
	            }
	          }
	          else
	            {
	              return -1;
	            }
	          }
	         protected static int BS(double [] arr,int L,int R,double element){
	          if(R>=L)
	          {
	            middle=L+(R-L)/2;
	            if(arr[middle]==element)
	            {
	                return middle;
	            }
	            else if(arr[middle]>element)
	            {
	                return BS(arr, L,middle-1, element);
	            }
	            else
	            {
	                return BS(arr, middle+1, R, element);
	            }
	          }
	          else
	            {
	              return -1;
	            }
	          }
	    }
	    public static class DataStructure{

	        public DataStructure() {
	        }

	     static void stack_push(Stack<Integer> stack)
	    {
	        for(int i = 0; i < 5; i++)
	        {
	            stack.push(i);
	        }
	    }

	    // Popping element from the top of the stack
	    static void stack_pop(Stack<Integer> stack)
	    {
	        System.out.println("Pop :");

	        for(int i = 0; i < 5; i++)
	        {
	            Integer y = (Integer) stack.pop();
	            System.out.println(y);
	        }
	    }

	    // Displaying element on the top of the stack
	    static void stack_peek(Stack<Integer> stack)
	    {
	        Integer element = (Integer) stack.peek();
	        System.out.println("Element on stack top : " + element);
	    }

	    // Searching element in the stack
	    static void stack_search(Stack<Integer> stack, int element)
	    {
	        Integer pos = (Integer) stack.search(element);

	        if(pos == -1)
	            System.out.println("Element not found");
	        else
	            System.out.println("Element is found at position " + pos);
	    }

	    }
	   public static class FIB {

	    protected static int MAX = 1000;
	    protected static long f[];
	    protected static int size=0;
	    // Returns n'th fibonacci number using
	    // table f[]

	    public FIB(int n)
	    {
	        f=new long[MAX];
	        this.size=n;
	        fib();
	    }

	        protected static void fib() {
	            f[0]=0;f[1]=1;
	            for (int i = 2; i < size; i++) {
	                //if(f[i-1]+f[i-2]>Long.MAX_VALUE){f[i]=0;continue;}
	                f[i]=f[i-1]+f[i-2];
	            }
	        }
	        protected static void printSeries(){
	            for (int i = 0; i <size; i++) {
	                System.out.print(f[i]+" ");
	            }

	        }
	    }
	    public static class Graph{

	    }
	   public static class StringPermutationGenerator {
	    // Generate all permutations of a string in Java
	    private Set<String> generatePermutations(String input) {

	        input = input.toLowerCase();
	        Set<String> result = new HashSet<>();
	        permutations("", input, result);
	        return result;

	    }
	     private void permutations(String prefix, String letters, Set<String> result) {

	        if (letters.length() == 0) {

	            result.add(prefix);

	        } else {

	            for (int i = 0; i < letters.length(); i++) {

	                String letter = letters.substring(i, i + 1);

	                String otherLetters = letters.substring(0, i) + letters.substring(i + 1);

	                permutations(prefix + letter, otherLetters, result);

	            }

	        }

	    }

	    }
	}
	/*
	Some References for doing things
	-Removing all Leading zeros in a string
	s.replaceFirst("^0+(?!$)", "");
	-Creating comprator
	public static class CustomComparator implements Comparator<c> {
	    @Override
	    public int compare(c o1, c o2) {
	        return o1.score.compareTo(o2.score);
	    }
	}
	-how to write switch case
	   switch(x)
	   {
	    case 1:
	    return l;
	    ...
	    default:
	    return m;
	   }
	-Convert numbers of and to different bases
	  Integer.toString(Integer.parseInt(number, base1), base2);
	-Split over white spaces:
	  myString.split("\\s+");
	-how to know if 4 points will form a square or a rectangle:
	    public static class point{
	            int a,b;
	            public point(int a, int b) {
	                this.a = a;
	                this.b = b;
	                }

	            @Override
	            public String toString() {
	                return "point{" + "a=" + a + ", b=" + b + '}';
	                }
	            }
	            public static int distSq(point p, point q)
	            {
	            return (p.a - q.a)*(p.a - q.a) +
	                    (p.b - q.b)*(p.b - q.b);
	             }
	         public static boolean isSquare(point p1, point p2, point p3, point p4)
	    {
	        int d2 = distSq(p1, p2);  // from p1 to p2
	        int d3 = distSq(p1, p3);  // from p1 to p3
	        int d4 = distSq(p1, p4);  // from p1 to p4

	        // If lengths if (p1, p2) and (p1, p3) are same, then
	        // following conditions must met to form a square.
	        // 1) Square of length of (p1, p4) is same as twice
	        //    the square of (p1, p2)
	        // 2) p4 is at same distance from p2 and p3
	        if (d2 == d3 && 2*d2 == d4)
	        {
	            int d = distSq(p2, p4);
	            return (d == distSq(p3, p4) && d == d2);
	        }

	        // The below two cases are similar to above case
	        if (d3 == d4 && 2*d3 == d2)
	        {
	            int d = distSq(p2, p3);
	            return (d == distSq(p2, p4) && d == d3);
	        }
	        if (d2 == d4 && 2*d2 == d3)
	        {
	            int d = distSq(p2, p3);
	            return (d == distSq(p3, p4) && d == d2);
	        }

	        return false;
	    }
	      public static boolean isRectangle(point p1,point p2,point p3,point p4)
	    {
	      double cx,cy;
	      double dd1,dd2,dd3,dd4;
	      double x1,y1,x2,y2,x3,y3,x4,y4;
	      x1=p1.a;y1=p1.b;x2=p2.a;y2=p2.b;x3=p3.a;y3=p3.b;x4=p4.a;y4=p4.b;
	      cx=(x1+x2+x3+x4)/4;
	      cy=(y1+y2+y3+y4)/4;

	      dd1=(cx-x1)*(cx-x1)+(cy-y1)*(cy-y1);
	      dd2=(cx-x2)*(cx-x2)+(cy-y2)*(cy-y2);
	      dd3=(cx-x3)*(cx-x3)+(cy-y3)*(cy-y3);
	      dd4=(cx-x4)*(cx-x4)+(cy-y4)*(cy-y4);
	      return dd1==dd2 && dd1==dd3 && dd1==dd4;
	    }
	    -left shift
	    //ex 00000001 << 3 == 00001000
	*/

import java.util.*;
import java.io.*;
public class Main {
    static int detbits(long temp){
        int bits = 0;
        while(temp > 0){
            temp /= 2;
            ++bits;
        }
        return bits;
    }
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        long l = Long.parseLong(st.nextToken());
        long r = Long.parseLong(st.nextToken());
        int bitsl = detbits(l);
        int bitsr = detbits(r);
        if (bitsr > bitsl) {
            System.out.println((1L << bitsr) - 1);
            return;
        }
        for (int i = 59; i >= 0; i--) {
            if (((1L << i) & l) == ((1L << i) & r)) continue;
            System.out.println((1L << (i + 1)) - 1);
            return;
        }
        System.out.print("0");
    }
    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class D {
	static long l, r;
	static long[][][][][] dp;
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader();
		l = in.nextLong();
		r = in.nextLong();
		dp = new long[65][2][2][2][2];
		for(int i = 0 ; i < 65;i++)
		for(int j = 0 ; j < 2;j++)
		for(int k = 0 ; k < 2;k++)
		for(int a = 0 ; a<2;a++)
		dp[i][j][k][a][0]=dp[i][j][k][a][1]=-1;
		System.out.println(go(63, 0, 0, 0, 0));
	}

	public static long go(int i, int a1, int a2, int b1, int b2) {
		if(i==-1)return 0;
		if(dp[i][a1][a2][b1][b2]!=-1)
			return dp[i][a1][a2][b1][b2];

		int f1 = 3, f2 = 3;
		int bl = (int) ((l >> i)) & 1, br = (int) ((r >> i) & 1);
		if (a2 == 0 && br==0)
			f1 &= 1;
		if(a1 == 0 && bl==1)
			f1 &= 2;
		if (b2 == 0 && br==0)
			f2 &= 1;
		if(b1 == 0 && bl==1)
			f2 &= 2;
		long res = 0;
		for(int x = 0 ; x<2;x++){
			for(int y = 0 ; y<2;y++){
				if(((f1>>x)&1) == 1 &&((f2>>y)&1) == 1){
					res = Math.max(res, (((long)(x^y))<<i)+go(i-1,x>bl||a1==1?1:0,x<br||a2==1?1:0,y>bl||b1==1?1:0,y<br||b2==1?1:0));
				}
			}
		}
		return dp[i][a1][a2][b1][b2]=res;
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer st;

		public InputReader() throws IOException {
			in = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(in.readLine());
		}

		public String next() throws IOException {
			while (!st.hasMoreElements())
				st = new StringTokenizer(in.readLine());
			return st.nextToken();
		}

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

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

import java.util.Scanner;

public class D {
    static long max;

    public static long[] getOneRange(long min, long max,int bit) {
        long st=(min&(((1l<<63)-1)&~((1l<<(bit+1))-1)))|(1l<<bit);
        long end=st|((1l<<(bit+1))-1);
        long interSt=Math.max(st,min);
        long interEnd=Math.min(end, max);
        if(interSt>interEnd) return null;
        return new long[]{interSt,interEnd};
    }

    public static long[] getZeroRange(long min, long max,int bit) {
        long st=min&(((1l<<63)-1)&~((1l<<(bit+1))-1));
        long end=st|((1l<<bit)-1);
        long interSt=Math.max(st,min);
        long interEnd=Math.min(end, max);
        if(interSt>interEnd) return null;
        return new long[]{interSt,interEnd};
    }

    public static void solve(int bitPosition, long min1, long max1, long min2,
            long max2, long curNum) {
        if (bitPosition == -1) {
            max = Math.max(max, curNum);
            return;
        }
        long[] firZeroRange = getZeroRange(min1, max1,bitPosition);
        long[] secZeroRange = getZeroRange(min2, max2,bitPosition);
        long[] firOneRange = getOneRange(min1, max1,bitPosition);
        long[] secOneRange = getOneRange(min2, max2,bitPosition);
        if ((firOneRange != null && secZeroRange != null)
                || (firZeroRange != null && secOneRange != null)) {
            long newNum = curNum | (1l << bitPosition);
            if (firOneRange != null && secZeroRange != null&&
                    (firOneRange[1]-firOneRange[0]+1)==1l<<bitPosition&&
                    (secZeroRange[1]-secZeroRange[0]+1)==1l<<bitPosition) {
                solve(bitPosition - 1, firOneRange[0], firOneRange[1],
                        secZeroRange[0], secZeroRange[1], newNum);
                return;
            }
            if (firZeroRange != null && secOneRange != null&&
                    (firZeroRange[1]-firZeroRange[0]+1)==1l<<bitPosition&&
                    (secOneRange[1]-secOneRange[0]+1)==1l<<bitPosition) {
                solve(bitPosition - 1, firZeroRange[0], firZeroRange[1],
                        secOneRange[0], secOneRange[1], newNum);
                return;
            }
            if (firOneRange != null && secZeroRange != null) {
                solve(bitPosition - 1, firOneRange[0], firOneRange[1],
                        secZeroRange[0], secZeroRange[1], newNum);
            }
            if (firZeroRange != null && secOneRange != null) {
                solve(bitPosition - 1, firZeroRange[0], firZeroRange[1],
                        secOneRange[0], secOneRange[1], newNum);
            }
        } else {
            solve(bitPosition - 1, min1, max1, min2, max2, curNum);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        max = 0;
        solve(62, l, r, l, r, 0);
        System.out.println(max);
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;

/**
 * @author thesparkboy
 *
 */
public class LittleGirlAndMaximumXOR {

	static long max_xor(long a, long b) {
		if (a > b) {
			return 0;
		}
		if (a == b) {
			return 0;
		}
		if (b - a == 1) {
			return a ^ b;
		}
		long mid = (a + b) / 2;
		long x = a ^ mid;
		long y = b ^ mid;
		if (x > y) {
			return max_xor(a, mid);
		} else {
			return max_xor(mid, b);
		}
	}

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		long l = in.readLong();
		long r = in.readLong();
		System.out.println(max_xor(l, r));
		out.close();
	}

	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		static boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}
	}

	private static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(outputStream);
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class b{
    public static void main(String args[]) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        long l=Long.parseLong(st.nextToken());
        long r=Long.parseLong(st.nextToken());
        String l_b=Long.toBinaryString(l);
        String r_b=Long.toBinaryString(r);
        int len_l=l_b.length();
        int len_r=r_b.length();
        if(len_l<len_r){
            for(int i=0;i<(len_r-len_l);i++) l_b="0"+l_b;
        }
        boolean eq=true;
        String ans="";
        for(int i=0;i<len_r;i++){
            if(!eq) ans+="1";
            else{
                if(l_b.charAt(i)!=r_b.charAt(i)){
                    eq=false;
                    ans+="1";
                } else ans+="0";
            }
        }
        System.out.println(Long.valueOf(ans,2));
    }
}

import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Solution {
    private IO io;
    private int ioMode = -1;
    private String problemName = "";
    private final String mjArgument = "master_j";

    public static void main(String programArguments[]) throws IOException{
        if(programArguments != null && programArguments.length > 0)
            new Solution().run(programArguments[0]);
        else
            new Solution().run(null);
    }

    private void run(String programArgument) throws IOException {
//         _______________________________________________ _________
//        |   Input Mode     |      Output Mode    | mode | comment |
//        |------------------|---------------------|----- |---------|
//        |   input.txt      |      System.out     |  0   |    mj   |
//        |   System.in      |      System.out     |  1   |  T / CF |
//        |<problemName>.in  |  <problemName>.out  |  2   |         |
//        |   input.txt      |      output.txt     |  3   |    C    |
//        |__________________|_____________________|______|_________|
        long nanoTime = 0;
        if(programArgument != null && programArgument.equals(mjArgument)) // mj
            ioMode = 0;
        else if(System.getProperty("ONLINE_JUDGE") != null) // T / CF
            ioMode = 1;
        else
            ioMode = 2;
        switch(ioMode){
            case -1:
                try{
                    throw new Exception("<ioMode> init failure") ;
                }catch (Exception e){
                    e.printStackTrace();
                }
                return;
            case 0:
                break;
            case 1:
                break;
            case 2:
                if(problemName.length() == 0){
                    try{
                        throw new Exception("<problemName> init failure");
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    return;
                }
            case 3:
                break;
        }
        io = new IO(ioMode, problemName);
        if(ioMode == 0){
            System.out.println("File output : \n<start>");
            System.out.flush();
            nanoTime = System.nanoTime();
        }
        solve();
        io.flush();
        if(ioMode == 0){
            System.out.println("</start>");
            long t = System.nanoTime() - nanoTime;
            int d3 = 1000000000, d2 = 1000000, d1 = 1000;
            if(t>=d3)
                System.out.println(t/d3 + "." + t%d3 + " seconds");
            else if(t>=d2)
                System.out.println(t/d2 + "." + t%d2 + " millis");
            else if(t>=d1)
                System.out.println(t/d1 + "." + t%d1 + " micros");
            else
                System.out.println(t + " nanos");
            System.out.flush();
        }
    }

    private boolean hasBit(long l, int p){
        return l > (1L << (p - 1) ^ l);
    }

    private void solve() throws IOException {
        long a = io.nL(), b = io.nL();
        for(int i = (int)(1 + log(b) / log(2)); i > 0; i--)
            if(hasBit(a, i) != hasBit(b, i)){
                io.wln(max(0, (long)pow(2, i) - 1));
                return;
            }
        io.wln(0);
    }//2.2250738585072012e-308

    /**
     * Input-output class
     * @author master_j
     * @version 0.2.5
     */
    @SuppressWarnings("unused")
    private class IO{
        private boolean alwaysFlush;
        StreamTokenizer in; PrintWriter out; BufferedReader br; Reader reader; Writer writer;
        public IO(int ioMode, String problemName) throws IOException{
            Locale.setDefault(Locale.US);
//         _______________________________________________ _________
//        |   Input Mode     |      Output Mode    | mode | comment |
//        |------------------|---------------------|----- |---------|
//        |   input.txt      |      System.out     |  0   |    mj   |
//        |   System.in      |      System.out     |  1   |  T / CF |
//        |<problemName>.in  |  <problemName>.out  |  2   |         |
//        |   input.txt      |      output.txt     |  3   |    C    |
//        |__________________|_____________________|______|_________|
            switch(ioMode){
                case 0:
                    reader = new FileReader("input.txt");
                    writer = new OutputStreamWriter(System.out);
                    break;
                case 1:
                    reader = new InputStreamReader(System.in);
                    writer = new OutputStreamWriter(System.out);
                    break;
                case 2:
                    reader = new FileReader(problemName + ".in");
                    writer = new FileWriter(problemName + ".out");
                    break;
                case 3:
                    reader = new FileReader("input.txt");
                    writer = new FileWriter("output.txt");
                    break;
            }
            br = new BufferedReader(reader);
            in = new StreamTokenizer(br);
            out = new PrintWriter(writer);
            alwaysFlush = false;
        }
        public void setAlwaysFlush(boolean arg){alwaysFlush = arg;}
        public void wln(){out.println(); if(alwaysFlush)flush();}
        public void wln(int arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(long arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(double arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(String arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(boolean arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(char arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(float arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(Object arg){out.println(arg); if(alwaysFlush)flush();}
        public void w(int arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(long arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(double arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(String arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(boolean arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(char arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(float arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(Object arg){out.print(arg); if(alwaysFlush)flush();}
        public void wf(String format, Object...args){out.printf(format, args); if(alwaysFlush)flush();}
        public void flush(){out.flush();}
        public int nI() throws IOException {in.nextToken(); return(int)in.nval;}
        public long nL() throws IOException {in.nextToken(); return(long)in.nval;}
        public String nS() throws IOException {in.nextToken(); return in.sval;}
        public double nD() throws IOException {in.nextToken(); return in.nval;}
        public float nF() throws IOException {in.nextToken(); return (float)in.nval;}
        public char nC() throws IOException {return (char)br.read();}
        public void wc(char...arg){for(char c : arg){in.ordinaryChar(c);in.wordChars(c, c);}}
        public void wc(String arg){wc(arg.toCharArray());}
        public void wc(char arg0, char arg1){in.ordinaryChars(arg0, arg1); in.wordChars(arg0, arg1);}
        public boolean eof(){return in.ttype == StreamTokenizer.TT_EOF;}
        public boolean eol(){return in.ttype == StreamTokenizer.TT_EOL;}
    }
}

import java.io.*;
import java.util.BitSet;
import java.util.StringTokenizer;

public class P276D {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        public void solve(InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            int i = 63;
            BitSet bl = new BitSet(63);
            BitSet br = new BitSet(63);
            set(bl, l);
            set(br, r);
            BitSet bx = new BitSet(63);
            while (i >= 0 && bl.get(i) == br.get(i)) {
                bx.clear(i);
                i--;
            }
            while (i >= 0) {
                if (bl.get(i) != br.get(i)) {
                    bx.set(i);
                } else {
                    if (!bl.get(i)) {
                        bl.set(i);
                        bx.set(i);
                    } else {
                        br.clear(i);
                        bx.set(i);
                    }
                }
                i--;
            }
            out.println(convert(bx));
        }

        public static long convert(BitSet bits) {
            long value = 0L;
            for (int i = 0; i < bits.length(); ++i) {
                value += bits.get(i) ? (1L << i) : 0L;
            }
            return value;
        }
        private void set(BitSet bs, long v) {
            int index = 0;
            while (v != 0L) {
                if (v % 2L != 0) {
                    bs.set(index);
                }
                ++index;
                v = v >>> 1;
            }
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++)
                arr[i] = nextInt();
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++)
                arr[i] = nextLong();
            return arr;
        }

    }

}

import java.util.*;
import java.io.*;
public class A
{
      static TreeSet<Long> ts;
      public static void main(String ar[]) throws Exception
      {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String s1[]=br.readLine().split(" ");
            long l=Long.parseLong(s1[0]);
            long r=Long.parseLong(s1[1]);

            ts=new TreeSet<Long>();
            long u=1;
            ts.add(u);
            for(int i=1;i<=62;i++)
            {
                  u=u*2;
                  ts.add(u);
            }

            long d=find(l,r);
            System.out.println(d);
      }

      public static long find(long l,long r)
      {
            if(r==l)
             return 0;
            long u=l^r;
            long v=ts.lower(u+1);
            return v^(v-1);
      }
}

import java.util.*;

import java.io.*;
import java.math.BigInteger;

public class A {

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int k) {
			x = d;
			y = k;
		}

		@Override
		public int compareTo(pair arg0) {
			// TODO Auto-generated method stub
			if (x == arg0.x) {
				return y - arg0.y;
			}
			return x - arg0.x;
		}
	}

	static PrintWriter pw;
	static int n;
	static int m;
	static int k;

	static ArrayList<Integer> a;

	static int bin(int x) {
		int s = 0;
		int e = a.size() - 1;
		int ans = -1;
		while (s <= e) {
			int mid = (s + e) / 2;
			if (a.get(mid) <= x) {
				s = mid + 1;
				ans = mid;
			} else
				e = mid - 1;
		}
		return ans;
	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		long m = Long.parseLong(st.nextToken());
		long n = Long.parseLong(st.nextToken());

		if (m == n)
			pw.println(0);
		else {
			char[] a = Long.toBinaryString(n).toCharArray();
			char[] b = Long.toBinaryString(m).toCharArray();
			char[] c = new char[a.length];
			int i = a.length - 1;
			for (int j = b.length - 1; j >= 0; j--, i--) {
				c[i] = b[j];
			}

			for (; i >= 0; i--)
				c[i] = '0';
			i = 0;
			for (i = 0; i < a.length; i++) {
				if (a[i] != c[i]) {
					break;
				}
			}
			System.out.println(pow(2,a.length-i) - 1);
		}
		pw.flush();
		pw.close();

	}

	static long pow(long a, long e) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res *= a;
			a *= a;
			e >>= 1;
		}
		return res;
	}

	static long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author roosephu
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        long l = in.nextLong(), r = in.nextLong();

        long ans = 0;
        for (int i = 0; i <= 60; ++i) {
            if ((l >> i & 1) != (r >> i & 1)) {
                ans = (2l << i) - 1;
            }
        }
        out.println(ans);
    }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.ObjectInputStream.GetField;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

	public class Q1 {

		static long MOD = 1000000007;
		static boolean b[], b1[], check;
		static ArrayList<Integer>[] amp, pa;
		static ArrayList<Pair>[] amp1;
		static ArrayList<Pair>[][] damp;
		static int left[],s[],right[],end[],sum[],dist[],cnt[],start[],color[],parent[],prime[],size[];
		static long ans = 0,k;
		static int p = 0;
		static FasterScanner sc = new FasterScanner(System.in);
		static Queue<Integer> queue = new LinkedList<>();
		static PriorityQueue<Integer> pq;
		static BufferedWriter log;
		static HashSet<Integer>[] hs;
		static HashMap<String,Integer> hm;
		static HashMap<Pair,Integer> hmp;
		static Stack<Integer> st;
		static boolean boo[][];
		static Pair prr[];
		static long parent1[],parent2[],size1[],size2[],arr1[],SUM[],MAX[];
		static int arr[];
		public static void main(String[] args) throws Exception {
	    	/*new Thread(null, new Runnable() {
				public void run() {
					try {

				} catch (Exception e) {
						System.out.println(e);
					}
				}
			}, "1", 1 << 26).start();*/
			soln();
		}
		static long dp[][];
		static int N,K,T;
		static int time = 0;
		static int cost[][];
		static boolean b11[];
		static HashMap<Pair,Integer> h = new HashMap<>();
		static long ans1;
		static long ans2;
		static ArrayList<Integer> ampp;
		public static void soln() throws IOException {
			//FasterScanner in = new FasterScanner(new FileInputStream("C:\\Users\\Admin\\Desktop\\QCL.txt"));
			//PrintWriter out = new PrintWriter("C:\\Users\\Admin\\Desktop\\A1.txt");
			log = new BufferedWriter(new OutputStreamWriter(System.out));
			long l = sc.nextLong(), r = sc.nextLong();
			String str = Long.toBinaryString(r);
			String str2 = Long.toBinaryString(l);
			StringBuilder sb = new StringBuilder();
			sb.append(str2);
			while(sb.length()!=str.length()) sb.insert(0, 0);
			str2 = sb.toString();
			sb = new StringBuilder();
			if(l==r){
				System.out.println(0);
				return;
			}
			boolean b = false, c = false;;
			for(int i = 0; i< str.length();i++){
				//System.out.println(str.charAt(i)+" "+str2.charAt(i));
				if(str.charAt(i)=='1'){
					if(str2.charAt(i)=='1'){
						if(c){
							for(int j = i;j<str.length();j++) sb.append('1');
							break;
						}
						else sb.append('0');
					}
					else{
						b = true;
						c = true;
						sb.append('1');
					}
				}
				else{
					if(str2.charAt(i)=='1') sb.append(1);
					else{
						if(b){
						for(int j = i;j<str.length();j++) sb.append('1');
						break;
						}
						else sb.append('0');
					}
				}
			}
			//System.out.println(sb);
			int cnt = 0;
			long ans = 0;
			for(int j = sb.length()-1;j>=0;j--){
				if(sb.charAt(j)=='1'){
					ans += (long)Math.pow(2, cnt);
				}
				//System.out.println(ans);
				cnt++;
			}
			System.out.println(ans);
			log.close();
			//out.close();
		}
		static boolean check(char c){
			if(c=='a' || c=='e' || c=='i' || c=='y' || c=='u' || c=='o') return true;
			return false;
		}
		static void bfs(int x){

		}
		static void dfs(int x){
			b[x] = true;
			if(amp[x].size()%2==1) p++;
			for(int p:amp[x]){
				if(!b[p]){
					dfs(p);
				}
			}
		}
		static long comp(long n, long m){
			int l = Math.max(Long.toBinaryString(n).length(),Long.toBinaryString(m).length());
			System.out.println((m&(n^MAX[l]))+" "+(((m^MAX[l])&n)));
			return 2*((m&(n^MAX[l]))+(((m^MAX[l])&n)));
		}
		static void recur(int n, int m, int k){
			if(n<0 || m<0) return;
			if(k==0){
				p++;
				return;
			}
			recur(n-k,m,k-1);
			recur(n,m-k,k-1);
			return;
		}
		public static void buildWeightedGraph(int n){
			for(int i =0 ;i< n; i++){
				int x = sc.nextInt(), y = sc.nextInt(), w = sc.nextInt();
				amp1[--x].add(new Pair(--y,w));
				amp1[y].add(new Pair(x,w));
			}
		}

		public static void seive(int n){
			b = new boolean[(n+1)];
			Arrays.fill(b, true);
			b[1] = false;
			for(int i = 2;i*i<=n;i++){
				if(b[i]){
					for(int p = 2*i;p<=n;p+=i){
						b[p] = false;
					}
				}
			}
			/*for(int i = 2;i<=n;i++){
				if(b[i]) prime[i] = i;
			}*/
		}

		static class Graph{
			int vertex;
			int weight;
			Graph(int v, int w){
				vertex = v;
				weight = w;
			}
		}
		static class Pair implements Comparable<Pair> {
			int u;
			int v;
			public Pair(){
				u = 0;
				v = 0;
			}
			public Pair(int u, int v) {
				this.u = u;
				this.v = v;
			}
			public int hashCode() {
				int hu = (int) (u ^ (u >>> 32));
				int hv = (int) (v ^ (v >>> 32));
				return 31*hu + hv;
			}

			public boolean equals(Object o) {
				Pair other = (Pair) o;
				return (u == other.u && v == other.v);
			}

			public int compareTo(Pair other) {
				return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(v, other.v));
			}

			public String toString() {
				return "[u=" + u + ", v=" + v + "]";
			}
		}

		public static void buildGraph(int n){
			for(int i =0;i<n;i++){
				int x = sc.nextInt()-1, y = sc.nextInt()-1;
				amp[x].add(y);
				amp[y].add(x);
			}
		}

		public static int getParent(long x){
			while(parent[(int) x]!=x){
				parent[ (int) x] = parent[(int) parent[ (int) x]];
				x = parent[ (int) x];
			}
			return (int) x;
		}
		static long min(long a, long b, long c){
			if(a<b && a<c) return a;
			if(b<c) return b;
			return c;
		}
		/*

		static class Pair3{
			int x, y ,z;
			Pair3(int x, int y, int z){
				this.x = x;
				this.y = y;
				this.z = z;
			}
		}*/
		static int sum(int n){
			String str = Integer.toString(n);
			int cnt = 0;
			for(int i = 0; i< str.length();i++){
				cnt+=(str.charAt(i)-'0');
			}
			return cnt;
		}
		 static void KMPSearch(String pat, String txt)
		    {
		        int M = pat.length();
		        int N = txt.length();

		        // create lps[] that will hold the longest
		        // prefix suffix values for pattern
		        int lps[] = new int[M];
		        int j = 0;  // index for pat[]

		        // Preprocess the pattern (calculate lps[]
		        // array)
		        computeLPSArray(pat,M,lps);

		        int i = 0;  // index for txt[]
		        while (i < N)
		        {
		            if (pat.charAt(j) == txt.charAt(i))
		            {
		                j++;
		                i++;
		            }
		            if (j == M)
		            {
		               // parent.add((i-j));
		                j = lps[j-1];
		            }

		            // mismatch after j matches
		            else if (i < N && pat.charAt(j) != txt.charAt(i))
		            {
		                // Do not match lps[0..lps[j-1]] characters,
		                // they will match anyway
		                if (j != 0)
		                    j = lps[j-1];
		                else
		                    i = i+1;
		            }
		        }
		    }
		 static void computeLPSArray(String pat, int M, int lps[])
		    {
		        // length of the previous longest prefix suffix
		        int len = 0;
		        int i = 1;
		        lps[0] = 0;  // lps[0] is always 0

		        // the loop calculates lps[i] for i = 1 to M-1
		        while (i < M)
		        {
		            if (pat.charAt(i) == pat.charAt(len))
		            {
		                len++;
		                lps[i] = len;
		                i++;
		            }
		            else  // (pat[i] != pat[len])
		            {
		                // This is tricky. Consider the example.
		                // AAACAAAA and i = 7. The idea is similar
		                // to search step.
		                if (len != 0)
		                {
		                    len = lps[len-1];

		                    // Also, note that we do not increment
		                    // i here
		                }
		                else  // if (len == 0)
		                {
		                    lps[i] = len;
		                    i++;
		                }
		            }
		        }
		    }
		private static void permutation(String prefix, String str) {
		    int n = str.length();
		    if (n == 0); //hs.add(prefix);
		    else {
		        for (int i = 0; i < n; i++)
		            permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n));
		    }
		}
		public static char give(char c1,char c2){
			if(c1!='a' && c2!='a') return 'a';
			if(c1!='b' && c2!='b') return 'b';
			return 'c';
		}

		public static void buildTree(int n){
			int arr[] = sc.nextIntArray(n);
			for(int i = 0;i<n;i++){
				int x = arr[i]-1;
				amp[i+1].add(x);
				amp[x].add(i+1);
			}
		}

		static class SegmentTree {
			boolean st[];
			boolean lazy[];

			SegmentTree(int n) {
				int size = 4 * n;
				st = new boolean[size];
				Arrays.fill(st, true);
				lazy = new boolean[size];
				Arrays.fill(lazy, true);
				//build(0, n - 1, 1);
			}

			/*long[] build(int ss, int se, int si) {
				if (ss == se) {
					st[si][0] = 1;
					st[si][1] = 1;
					st[si][2] = 1;
					return st[si];
				}
				int mid = (ss + se) / 2;
				long a1[] = build(ss, mid, si * 2), a2[] = build(mid + 1, se,
						si * 2 + 1);
				long ans[] = new long[3];
				if (arr[mid] < arr[mid + 1]) {
					ans[1] = Math.max(a2[1], Math.max(a1[1], a1[2] + a2[0]));
					if (a1[1] == (mid - ss + 1))
						ans[0] = ans[1];
					else
						ans[0] = a1[0];
					if (a2[2] == (se - mid))
						ans[2] = ans[1];
					else
						ans[2] = a2[2];
				} else {
					ans[1] = Math.max(a1[1], a2[1]);
					ans[0] = a1[0];
					ans[2] = a2[2];
				}
				st[si] = ans;
				return st[si];
			}*/

			void update(int si, int ss, int se, int idx, long x) {
				if (ss == se) {
					//arr[idx] += val;
					st[si]=false;
				}
				else {
					int mid = (ss + se) / 2;
					if(ss <= idx && idx <= mid)
			        {
			             update(2*si, ss, mid, idx, x);
			        }
			        else
			        { update(2*si+1, mid+1, se, idx, x);
			        }
					st[si] = st[2*si]|st[2*si+1];
				}
			}
			/*boolean get(int qs, int qe, int ss, int se, int si){
				if(qs>se || qe<ss) return 0;
				if (qs <= ss && qe >= se) {
					return st[si];
				}
				int mid = (ss+se)/2;
				return get(qs, qe, ss, mid, si * 2)+get(qs, qe, mid + 1, se, si * 2 + 1);
			}*/
			void updateRange(int node, int start, int end, int l, int r, boolean val)
			{
			    if(!lazy[node])
			    {
			        // This node needs to be updated
			        st[node] = lazy[node];    // Update it
			        if(start != end)
			        {
			            lazy[node*2] = lazy[node];                  // Mark child as lazy
			            lazy[node*2+1] = lazy[node];                // Mark child as lazy
			        }
			        lazy[node] = true;                                  // Reset it
			    }
			    if(start > end || start > r || end < l)              // Current segment is not within range [l, r]
			        return;
			    if(start >= l && end <= r)
			    {
			        // Segment is fully within range
			        st[node] =  val;
			        if(start != end)
			        {
			            // Not leaf node
			            lazy[node*2] = val;
			            lazy[node*2+1] = val;
			        }
			        return;
			    }
			    int mid = (start + end) / 2;
			    updateRange(node*2, start, mid, l, r, val);        // Updating left child
			    updateRange(node*2 + 1, mid + 1, end, l, r, val);   // Updating right child
			    st[node] = st[node*2] | st[node*2+1];        // Updating root with max value
			}

			boolean queryRange(int node, int start, int end, int l, int r)
			{
			    if(start > end || start > r || end < l)
			        return false;         // Out of range
			    if(!lazy[node])
			    {
			        // This node needs to be updated
			        st[node] = lazy[node];            // Update it
			        if(start != end)
			        {
			            lazy[node*2] = lazy[node];         // Mark child as lazy
			            lazy[node*2+1] = lazy[node];    // Mark child as lazy
			        }
			        lazy[node] = true;                 // Reset it
			    }
			    if(start >= l && end <= r)             // Current segment is totally within range [l, r]
			        return  st[node];
			    int mid = (start + end) / 2;
			    boolean p1 = queryRange(node*2, start, mid, l, r);         // Query left child
			    boolean b = queryRange(node*2 + 1, mid + 1, end, l, r); // Query right child
			    return (p1 | b);
			}
			void print() {
				for (int i = 0; i < st.length; i++) {
					System.out.print(st[i]+" ");
				}
				System.out.println();
			}
		}
		static int convert(int x){
			int cnt = 0;
			String str = Integer.toBinaryString(x);
			//System.out.println(str);
			for(int i = 0;i<str.length();i++){
				if(str.charAt(i)=='1'){
					cnt++;
				}
			}
			int ans = (int) Math.pow(3, 6-cnt);
			return ans;
		}
		static class Node2{
			Node2 left = null;
			Node2 right = null;
			Node2 parent = null;
			int data;
		}
		static class BinarySearchTree{
			Node2 root = null;
			int height = 0;
			int max = 0;
			int cnt = 1;
			ArrayList<Integer> parent = new ArrayList<>();
			HashMap<Integer, Integer> hm = new HashMap<>();
			public void insert(int x){
				Node2 n = new Node2();
				n.data = x;
				if(root==null){
					root = n;
				}
				else{
					Node2 temp = root,temb = null;
					while(temp!=null){
						temb = temp;
						if(x>temp.data) temp = temp.right;
						else temp = temp.left;
					}
					if(x>temb.data) temb.right = n;
					else temb.left = n;
					n.parent = temb;
					parent.add(temb.data);
				}
			}
			public Node2 getSomething(int x, int y, Node2 n){
				if(n.data==x || n.data==y) return n;
				else if(n.data>x && n.data<y) return n;
				else if(n.data<x && n.data<y) return getSomething(x,y,n.right);
				else return getSomething(x,y,n.left);
			}
			public Node2 search(int x,Node2 n){
				if(x==n.data){
					max = Math.max(max, n.data);
					return n;
				}
				if(x>n.data){
					max = Math.max(max, n.data);
					return search(x,n.right);
				}
				else{
					max = Math.max(max, n.data);
					return search(x,n.left);
				}
			}
			public int getHeight(Node2 n){
				if(n==null) return 0;
				height = 1+ Math.max(getHeight(n.left), getHeight(n.right));
				return height;
			}
		}
		static long findDiff(long[] arr, long[] brr, int m){
			int i = 0, j = 0;
			long fa = 1000000000000L;
			while(i<m && j<m){
				long x = arr[i]-brr[j];
				if(x>=0){
					if(x<fa) fa = x;
					j++;
				}
				else{
					if((-x)<fa) fa = -x;
					i++;
				}
			}
			return fa;
		}
		public static long max(long x, long y, long z){
			if(x>=y && x>=z) return x;
			if(y>=x && y>=z) return y;
			return z;
		}

		static long modInverse(long a, long mOD2){
		            return  power(a, mOD2-2, mOD2);
		}
		static long power(long x, long y, long m)
		{
		    if (y == 0)
		        return 1;
		    long p = power(x, y/2, m) % m;
		    p = (p * p) % m;

		    return (y%2 == 0)? p : (x * p) % m;
		}
		static long power2(long x,BigInteger y,long m){
			long ans = 1;
			BigInteger two = new BigInteger("2");
			while(y.compareTo(BigInteger.ZERO)>0){
				if(y.getLowestSetBit()==y.bitCount()){
					x = (x*x)%MOD;
					y = y.divide(two);
				}
				else{
					ans = (ans*x)%MOD;
					y = y.subtract(BigInteger.ONE);
				}
			}
			return ans;
		}
		static BigInteger power2(BigInteger x, BigInteger y, BigInteger m){
			BigInteger ans = new BigInteger("1");
			BigInteger one  = new BigInteger("1");
			BigInteger two  = new BigInteger("2");
			BigInteger zero  = new BigInteger("0");
			while(y.compareTo(zero)>0){
				//System.out.println(y);
				if(y.mod(two).equals(one)){
					ans = ans.multiply(x).mod(m);
					y = y.subtract(one);
				}
				else{
					x = x.multiply(x).mod(m);
					y = y.divide(two);
				}
			}
			return ans;
		}
		static BigInteger power(BigInteger x, BigInteger y, BigInteger m)
		{
		    if (y.equals(0))
		        return (new BigInteger("1"));
		    BigInteger p = power(x, y.divide(new BigInteger("2")), m).mod(m);
		    p = (p.multiply(p)).mod(m);

		    return (y.mod(new BigInteger("2")).equals(0))? p : (p.multiply(x)).mod(m);
		}
		static long d,x,y;
		public static void extendedEuclidian(long a, long b){
			if(b == 0) {
		        d = a;
		        x = 1;
		        y = 0;
		    }
		    else {
		        extendedEuclidian(b, a%b);
		        int temp = (int) x;
		        x = y;
		        y = temp - (a/b)*y;
		    }
		}

		public static long gcd(long n, long m){
			if(m!=0) return gcd(m,n%m);
			else return n;
		}

		static BufferedReader reader;
	    static StringTokenizer tokenizer;
	    static PrintWriter writer;

	    static class FasterScanner {

			private final InputStream stream;
			private final byte[] buf = new byte[8192];
			private int curChar, snumChars;
			private SpaceCharFilter filter;

			public FasterScanner(InputStream stream) {
				this.stream = stream;
			}

			public int snext() {
				if (snumChars == -1)
					throw new InputMismatchException();
				if (curChar >= snumChars) {
					curChar = 0;
					try {
						snumChars = stream.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (snumChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}

			public int nextInt() {
				int c = snext();
				while (isSpaceChar(c)) {
					c = snext();
				}
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = snext();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = snext();
				} while (!isSpaceChar(c));
				return res * sgn;
			}

			public long nextLong() {
				int c = snext();
				while (isSpaceChar(c)) {
					c = snext();
				}
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = snext();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = snext();
				} while (!isSpaceChar(c));
				return res * sgn;
			}

			public int[] nextIntArray(int n) {
				int a[] = new int[n];
				for (int i = 0; i < n; i++) {
					a[i] = nextInt();
				}
				return a;
			}

			public long[] nextLongArray(int n) {
				long a[] = new long[n];
				for (int i = 0; i < n; i++) {
					a[i] = nextInt();
				}
				return a;
			}

			public String readString() {
				int c = snext();
				while (isSpaceChar(c)) {
					c = snext();
				}
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = snext();
				} while (!isSpaceChar(c));
				return res.toString();
			}

			public String nextLine() {
				int c = snext();
				while (isSpaceChar(c))
					c = snext();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = snext();
				} while (!isEndOfLine(c));
				return res.toString();
			}

			public boolean isSpaceChar(int c) {
				if (filter != null)
					return filter.isSpaceChar(c);
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}

			private boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			}

			public interface SpaceCharFilter {
				public boolean isSpaceChar(int ch);
			}
		}
	}

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

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    class GraphBuilder {
        int n, m;
        int[] x, y;
        int index;
        int[] size;

        GraphBuilder(int n, int m) {
            this.n = n;
            this.m = m;
            x = new int[m];
            y = new int[m];
            size = new int[n];
        }

        void add(int u, int v) {
            x[index] = u;
            y[index] = v;
            size[u]++;
            size[v]++;
            index++;
        }

        int[][] build() {
            int[][] graph = new int[n][];
            for (int i = 0; i < n; i++) {
                graph[i] = new int[size[i]];
            }
            for (int i = index - 1; i >= 0; i--) {
                int u = x[i];
                int v = y[i];
                graph[u][--size[u]] = v;
                graph[v][--size[v]] = u;
            }
            return graph;
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long[] readLongArray(int size) throws IOException {
        long[] res = new long[size];
        for (int i = 0; i < size; i++) {
            res[i] = readLong();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    public static void main(String[] args) {
        new Template().run();
        // new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    void solve() throws IOException {
        long l = readLong();
        long r = readLong();
        if (l == r) {
            out.println(0);
            return;
        }
        long xor = l ^ r;
        xor |= Long.highestOneBit(xor) - 1;
        out.println(xor);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.util.*;

public class Soly
{
    static final int INF = Integer.MAX_VALUE;

    static int mergeSort(int[] a,int [] c, int begin, int end)
    {
        int inversion=0;
        if(begin < end)
        {
            inversion=0;
            int mid = (begin + end) >>1;
            inversion+= mergeSort(a,c, begin, mid);
            inversion+=mergeSort(a, c,mid + 1, end);
            inversion+=merge(a,c, begin, mid, end);
        }
        return inversion;
    }
/////////////////////////////////////////////////////

    static int  merge(int[] a,int[]c, int b, int mid, int e)
    {
        int n1 = mid - b + 1;
        int n2 = e - mid;
        int[] L = new int[n1+1], R = new int[n2+1];
        int[] L1 = new int[n1+1], R1 = new int[n2+1];
        //inversion
        int inversion=0;

        for(int i = 0; i < n1; i++) {
            L[i] = a[b + i];
            L1[i] = c[b + i];
        }
        for(int i = 0; i < n2; i++)  {
            R[i] = a[mid + 1 + i];
            R1[i] = c[mid + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for(int k = b, i = 0, j = 0; k <= e; k++)
            if(L[i] <= R[j]){
                a[k] = L[i];
                c[k] = L1[i++];
            }

            else
            {
                a[k] = R[j];
                c[k] = R1[j++];
                inversion=inversion+(n1-i);

            }
        return inversion;

    }
    //////////////////////////////////////////////////////////////
static int l;
 static int va(char[]a){
     Stack<Character>s= new Stack<>();
     int op=0,c=0;
     for (int p = 0; p < a.length; p++) {
         if (a[p]==')'){
             if (!s.isEmpty()){
                 if (s.peek()=='('){
                     op--;
                     s.pop();
                 }
                 else{
                     ++c;
                     s.push(')');
                 }
             }
             else {
                 ++c;
                 s.push(')');
             }
         }
         else if(a[p]=='(') {
             ++op;
             if (!s.isEmpty()){
                 if (s.peek()=='('){
                     s.push(a[p]);
                 }
                 else s.push('(');
             }
             else s.push('(');
         }
     }
     if (s.isEmpty())return 0;
     else {
         if (op>0&&c>0)return 50;
         if (s.peek()=='('){
             //1 opening
             l=s.size();
             return 1;
         }
         else {
             //2 closing
             l=s.size();
             return 2;
         }
     }

 }

/////////////////////////////////////////////////////////////////////////////////
    static public int maxSubArray(int[] nums) {
        boolean s= false,s2=false;
       int ans2=Integer.MIN_VALUE;
        int ans=0,sum=0;
       for (int i = 0; i < nums.length; i++) {
           if (nums[i]>=0)s=true;
           if (nums[i]<0)s2=true;
           ans2=Math.max(ans2,nums[i]);
           if (sum+nums[i]>0)sum+=nums[i];
           else sum=0;
           ans=Math.max(ans,sum);
       }
       if (!s2)return ans;
       if (!s)return ans2;
       else {
           return ans;

       }
   }
    static long[]a;
 static long[][]mem;
 static int k;
 static long dp(int i,int rem){
     if (i==a.length)return 0;
     if (rem==0)return 1;
     if (mem[i][rem]!=-1)return mem[i][rem];
     long ret=0;
    if (i+1<a.length){
        if (a[i+1]==a[i]*1l*k)ret+=dp(i+1,rem-1);
        else ret+=dp(i+1,rem);
    }
     return mem[i][rem]=ret;
 }

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        try (PrintWriter or = new PrintWriter(System.out)) {

            long a= in.nextLong(),b=in.nextLong();
            if (a==b){
                or.println(0);
                return;
            }
            for (int i = 63; i>=0 ; --i) {
                if ((a&(1l<<i))!=(b&(1l<<i))){
                    or.println((1l<<i+1)-1);
                    break;
                }
            }

        }
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }

}
class  Triple{
   int r,c,x,y;
    public Triple(int r, int c, int x, int y) {
        this.r = r;
        this.c = c;
        this.x = x;
        this.y = y;
    }
}

import java.util.*;
import java.io.*;
import java.awt.Point;

public class CF276D {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] buffer = br.readLine().split(" ");
		long left = Long.parseLong(buffer[0]);
		long right = Long.parseLong(buffer[1]);
		if(left == right) {
			System.out.println(0);
			return;
		}
		String leftStr = Long.toBinaryString(left);
		String rightStr = Long.toBinaryString(right);
		int x = leftStr.length();
		int y = rightStr.length();
		int p = y - x;
		String tmp = "";
		for(int f = 0; f < p; f ++)tmp+="0";
		leftStr = tmp + leftStr;
		x = leftStr.length();
		//System.out.println(leftStr);
		//System.out.println(rightStr);
		String res = "";
		int i = 0;
		boolean onePresent = false;
		while(i < x && leftStr.charAt(i) == rightStr.charAt(i)) i++;
		int n = x - i;
		for(int k = 0; k<n; k++)res += "1";
		//System.out.println(res);
		System.out.println(Long.parseLong(res, 2));

		// res = rightStr.substring(0, y - x);
		// for(int i = 0; i < x; i++) {
		// 	res = res + "1";
		// }
		//System.out.println(Long.parseLong(res, 2));
	}

}

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {

  public void solve(int testNumber, InputReader in, PrintWriter out) {
    long l = in.readLong(), r = in.readLong();
    int pow = 62;
    long mask = 1L << pow;
    while (((r | l) & mask) == 0){
      pow--;
      mask = 1L << pow;
    }
    while (true) {
      if (((r ^ l) & mask) == mask || pow < 0) {
        break;
      }
      mask >>= 1;
      l = l & ~(1L << pow);
      r = r & ~(1L << pow);
      pow--;
    }
    pow++;
    out.print((1L << pow) - 1);
  }
}

class InputReader {

  private InputStream stream;
  private byte[] buf = new byte[1024];
  private int curChar;
  private int numChars;

  public InputReader(InputStream stream) {
    this.stream = stream;
  }

  public int read() {
    if (numChars == -1)
      throw new InputMismatchException();
    if (curChar >= numChars) {
      curChar = 0;
      try {
        numChars = stream.read(buf);
      } catch (IOException e) {
        throw new InputMismatchException();
      }
      if (numChars <= 0)
        return -1;
    }
    return buf[curChar++];
  }

  public long readLong() {
    int c = read();
    while (isSpaceChar(c))
      c = read();
    int sgn = 1;
    if (c == '-') {
      sgn = -1;
      c = read();
    }
    long res = 0;
    do {
      if (c < '0' || c > '9')
        throw new InputMismatchException();
      res *= 10;
      res += c - '0';
      c = read();
    } while (!isSpaceChar(c));
    return res * sgn;
  }

  public static boolean isSpaceChar(int c) {
    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
  }

  }

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

public class D {
    public static void main(String[] args) throws IOException {
        new D().solve();
    }

    void solve() throws IOException {
        Scanner sc = new Scanner(System.in);
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] sp;

        long L = sc.nextLong();
        long R = sc.nextLong();
        if (L == R) {
            System.out.println(0);
        } else {
            System.out.println(Long.highestOneBit(R ^ L) * 2 - 1);
        }
    }
}

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		long L=Long.parseLong(st.nextToken());
		long R=Long.parseLong(st.nextToken());
//		long max=L^R;
		long count=0;
//		System.out.println("L   ="+Long.toBinaryString(L));
//		System.out.println("R   ="+Long.toBinaryString(R));
		while(L!=0 || R!=0){
			int LB=(int) (L&1);
			int RB=(int) (R&1);
//			System.out.println("bits "+LB+" "+RB);
			if(LB!=RB){
				count++;
			}else{
				if(LB==1&&RB==1){
					if(R-1>L){
						R--;
						count++;
					}
				}else if(LB==0 && RB==0){
					if(L+1<R){
						L++;
						count++;
					}
				}
			}
			L >>= 1;
			R >>= 1;
//			System.out.println(L+" "+R);
		}
		StringBuffer oneSB=new StringBuffer("0");
		for(int i=0;i<count;i++)
			oneSB.append('1');
		long ans=Long.parseLong(oneSB.toString(),2);
//		System.out.println("count="+count);
		System.out.println(ans);
//		System.out.println("L   ="+Long.toBinaryString(L));
//		System.out.println("R   ="+Long.toBinaryString(R));
//		System.out.println("ans ="+Long.toBinaryString(ans));
//		System.out.println("ans ="+Long.toBinaryString(576460752303423487L));
		br.close();
	}// end of main(String[])

}// end of class Main

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Dominated_Subarray {

  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

  static class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new
          InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

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

    String[] nextSArray() {
      String sr[] = null;
      try {
        sr = br.readLine().trim().split(" ");
      } catch (IOException e) {
        e.printStackTrace();
      }
      return sr;
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }

      return str;
    }
  }

  //  static int MOD=1000000000+7;
//  public static void sortbyCol(int arr[][],int col)
//  {
//    Arrays.sort(arr,new Comparator<int[]>(){
//      @Override
//      public int compare(int[] o1, int[] o2) {
//        // To sort in descending order revert
//        // the '>' Operator
//        if(o1[col]>o2[col])
//          return 1;
//        else
//          return -1;
//      }
//    });
//  }

  public static void main(String[] args) throws java.lang.Exception {
    FastReader sc = new FastReader();
//   int t1=sc.nextInt();
//   for(int t=0;t<t1;++t)
//   {
//
//
//   }
    long a=sc.nextLong();
    long b=sc.nextLong();
    if(a==b)
    {
      System.out.println(0);
      return;
    }
    long bit=(long) Math.pow(2,60);
   // System.out.println(Long.toBinaryString(a));
   // System.out.println(Long.toBinaryString(b));
    while(bit>0)
    {
      if((a&bit)!=(b&bit))
      {
        break;
      }
      bit=bit>>1;
    }
   // System.out.println(bit);
    long ans=bit|(bit-1);
    out.println(ans);
    out.flush();
    out.close();

  }

}

// out.println(al.toString().replaceAll("[\\[|\\]|,]",""));

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class con169_D {

	private static final boolean DEBUG = false;

	public static void main( final String[] args ) throws Exception {
		final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
		final String line = br.readLine();
		final StringTokenizer tok = new StringTokenizer( line );

		final long L = Long.parseLong( tok.nextToken() );
		final long R = Long.parseLong( tok.nextToken() );

		System.out.println( solve( L, R ) );
	}

	public static long solve( final long L, final long R ) {
		if ( L == R ) return L ^ R;
		if ( DEBUG ) System.out.printf( "L=%d (%s), R=%d (%s)\n", L, Long.toBinaryString( L ), R,
				Long.toBinaryString( R ) );

		final int ld = length( L );
		final int ldm1 = ld - 1;
		final int rd = length( R );

		if ( ld < rd ) {
			long max = 1;
			while ( length( max ) < rd ) {
				max <<= 1;
			}
			long min = 1;
			while ( length( min ) < rd - 1 ) {
				min <<= 1;
				++min;
			}
			if ( DEBUG ) System.out.printf( "min=%d (%s), max=%d (%s)\n", min, Long.toBinaryString( min ), max,
						Long.toBinaryString( max ) );
			return min ^ max;
		} else {
			final char[] minStr = Long.toBinaryString( L ).toCharArray();
			final char[] maxStr = Long.toBinaryString( R ).toCharArray();
			final char[] res = new char[minStr.length];
			Arrays.fill( res, '0' );
			{
				int i = 0;
				while ( i < res.length ) {
					if ( minStr[ i ] == maxStr[ i ] ) {
						res[ i ] = '0';
					} else {
						break;
					}
					++i;
				}
				if ( DEBUG ) System.out.println( "diff at pos: " + i );
				if ( minStr[ i ] == '0' ) {
					res[ i++ ] = '1';
					for ( int j = i; j < res.length; ++j ) {
						res[ j ] = '1';
					}
				} else {
					throw new IllegalArgumentException();
				}
			}
			return Long.parseLong( new String( res ), 2 );
		}
	}

	private static int length( long l ) {
		int res = 0;
		while ( l > 0 ) {
			++res;
			l >>= 1;
		}
		return res;
	}

}

import java.util.*;
import java.math.*;
public class Main
{
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
	    long n=scan.nextLong();
	    long m=scan.nextLong();
	    long xor=n^m;
	    long cnt=1;
	    while(xor>0){
	        xor>>=1;
	        cnt<<=1;
	    }
	    cnt--;
	    System.out.println(cnt);
	}
}

import java.io.*;
import java.util.*;
public class Solution
{
    public static void main(String ag[])
    {
        Scanner sc=new Scanner(System.in);
        int i,j,k;
        long L=sc.nextLong();
        long R=sc.nextLong();

        int posL=findHighestSetBit(L);
        int posR=findHighestSetBit(R);

        long ans=0;
        if(posL!=posR)
        {
            ans=(1L<<(posR+1))-1;
        }
        else
        {
            for(i=63;i>=0;i--)
            {
                if((R&(1L<<i))>=1&&(L&(1L<<i))==0)
                {
                    ans=(1L<<(i+1))-1;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
    public static int findHighestSetBit(long N)
    {
        for(int i=63;i>=0;i--)
        {
            if((N&(1L<<i))>=1)
            return i;
        }
        return 0;
    }
}

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

public class Codeforces
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        String s[]=bu.readLine().split(" ");
        long ans=0,a=Long.parseLong(s[0]),b=Long.parseLong(s[1]);
        ans=a^b;
        long p2=1,res=0;
        while(ans!=0)
        {
            res+=p2;
            p2*=2;
            ans>>=1;
        }
        System.out.print(res);
    }
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {

	public static void main(String [] args ) {
		try{
			String str;
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			BufferedOutputStream bos = new BufferedOutputStream(System.out);
			String eol = System.getProperty("line.separator");
			byte [] eolb = eol.getBytes();
			byte[] spaceb= " ".getBytes();

			str  = br.readLine();
			int blank = str.indexOf( " ");
			long l = Long.parseLong(str.substring(0,blank));
			long r = Long.parseLong(str.substring(blank+1));
			String one = "";
			String two = "";
			while(l>0) {
				if((l%2)==0) {
					one = "0".concat(one);
				} else {
					one = "1".concat(one);
				}
				l/=2;
			}
			while(r>0) {
				if((r%2)==0) {
					two = "0".concat(two);
				} else {
					two = "1".concat(two);
				}
				r/=2;
			}
			while(one.length()<60) {
				one = "0".concat(one);
			}
			while(two.length()<60) {
				two = "0".concat(two);
			}
			int iter = 0;
			String xor = "";
			boolean big = false;
			boolean small = false;
			while(one.charAt(iter) == two.charAt(iter)) {
				xor = xor.concat("0");
				iter++;
				if(iter==60) {
					break;
				}
			}
			for(int i = iter ; i < 60 ; i++) {
				xor = xor.concat("1");
			}
			bos.write(new BigInteger(xor,2).toString().getBytes());
			bos.write(eolb);
			bos.flush();
		}  catch(IOException ioe) {
			ioe.printStackTrace();
		}
	}
}

/**
 * Created with IntelliJ IDEA.
 * User: Fcdkbear
 * Date: 11.02.13
 * Time: 16:48
 * To change this template use File | Settings | File Templates.
 */
import java.util.Scanner;

public class test {
	static long[][][][][] dp;
	static String s1,s2;
	static String getbin (long num)
	{
		String tmp="";
		while (num>0)
		{
			long v=(num%2);
			tmp+=(char)(v+'0');
			num/=2;
		}
		String res="";
		int n=tmp.length();
		for (int i=n-1; i>=0; --i)
			res+=tmp.charAt(i);
		return res;
	}
	static int len;
	static long rec(int p, int fl1, int fl2, int fr1, int fr2)
	{
		if (p==len)
			return 0;
		if (dp[p][fl1][fl2][fr1][fr2] != -1)
			return dp[p][fl1][fl2][fr1][fr2];
		int min1 = 0, max1 = 1;
		if ((fl1 == 0) && (s1.charAt(p) == '1'))
			min1 = 1;
		if ((fl2 == 0) && (s2.charAt(p) == '0'))
			max1 = 0;
		int min2 = 0, max2 = 1;
		if ((fr1 == 0) && (s1.charAt(p) == '1'))
			min2 = 1;
		if ((fr2 == 0) && (s2.charAt(p) == '0'))
			max2 = 0;
		long res = 0;
		for (int i=min1; i<=max1; ++i)
		for (int j=min2; j<=max2; ++j)
		{
			int v = (i ^ j);
			long toadd = 0;
			if (v == 1) {
				int step = len - p - 1;
				toadd = (1L << step);
			}
			int nfl1 = fl1, nfl2 = fl2, nfr1 = fr1, nfr2 = fr2;
			if (i > s1.charAt(p) - '0')
				nfl1 = 1;
			if (i < s2.charAt(p) - '0')
				nfl2 = 1;
			if (j > s1.charAt(p) - '0')
				nfr1 = 1;
			if (j < s2.charAt(p) - '0')
				nfr2 = 1;
			long res1= toadd + rec(p + 1, nfl1, nfl2, nfr1, nfr2);
			res = Math.max(res,res1);
		}
		return dp[p][fl1][fl2][fr1][fr2] = res;
	}
	public static void main(String [] args)
	{
		dp=new long[70][2][2][2][2];
		for (int i=0; i<70; ++i)
			dp[i]=new long[2][2][2][2];
		for (int i = 0; i < 70; ++i)
			for (int j=0; j<2; ++j)
				dp[i][j] = new long[2][2][2];
		for (int i = 0; i < 70; ++i)
			for (int j = 0; j < 2; ++j)
				for (int k=0; k<2; ++k)
					dp[i][j][k] = new long[2][2];
		for (int i = 0; i < 70; ++i)
			for (int j = 0; j < 2; ++j)
				for (int k = 0; k < 2; ++k)
					for (int c=0; c<2; ++c)
						dp[i][j][k][c] = new long[2];
		for (int i = 0; i < 70; ++i)
			for (int j = 0; j < 2; ++j)
				for (int k = 0; k < 2; ++k)
					for (int c = 0; c < 2; ++c)
						for (int l=0; l<2; ++l)
							dp[i][j][k][c][l]=-1;
		Scanner sc = new Scanner(System.in);
		long l=sc.nextLong();
		long r=sc.nextLong();
		s1=getbin(l);
		s2=getbin(r);
		while (s1.length()<s2.length())
			s1="0"+s1;
		len=s1.length();
		//System.out.println(s1);
		//System.out.println(s2);
		long res=rec(0,0,0,0,0);
		System.out.println(res);
	}
}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R169_Div2_D //Name: Little Girl and Maximum XOR
{
	FastReader in;
	PrintWriter out;

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

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		long l = in.nextLong();
		long r = in.nextLong();

        if (l == r)
        	out.println(0); // l ^ r
        else
        {
            long num = 0;
            for (int i = 62; i >= 0; i--)
            {
                long num1 = 1L << i;
                while (num + num1 > r) num1 /= 2;
                num += num1;
                if (num - 1 >= l) break;
            }

            // (num - 1 >= l)
            out.println(num ^ (num - 1));
        }
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.util.*;

public class Code {
	public Code(){}
	public static void main(String args[]){
		Scanner QQQ=new Scanner(System.in);
		long l=QQQ.nextLong();
		long r=QQQ.nextLong();
		long ans=l^r;
		int a[]=new int [70];
		int b[]=new int [70];
		int n=0,m=0;
		while (l!=0){
			a[m]=(int)(l%2);
			l/=2;
			m++;
		}
		while (r!=0){
			b[n]=(int)(r%2);
			r/=2;
			n++;
		}
		m--;n--;
		long deg[]=new long [70];
		deg[0]=1;
		for (int i=1;i<=62;i++) deg[i]=deg[i-1]*2;
		for (int i=n;i>=0;i--)
			if (b[i]==1&&a[i]==0){
				System.out.println(deg[i+1]-1);
				return;
			}
		System.out.println(ans);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {
	static BufferedReader in;
	static StringTokenizer st;
	static PrintWriter out;
	public static void main(String[] args) throws IOException {
		begin();
		solve();
		end();
	}
	private static void end() {
		out.close();
	}
	private static void solve() throws IOException {
		long l = nextLong();
		long r = nextLong();
		int p = 63;
		while (p >= 0 && hing(l,p) == hing(r,p)){
			p--;
		}
		write((1L<<(p+1))-1);

	}
	private static boolean hing(long x, int bit) {
		return (x&(1L<<bit)) != 0;
	}
	private static long nextLong() throws  IOException {
		return Long.parseLong(next());
	}
	private static void writeln(Object t) {
		out.println(t);
	}
	private static void write(Object t) {
		out.print(t);
	}
	private static int nextInt() throws  IOException {
		return Integer.parseInt(next());
	}
	private static String next() throws IOException {
		while (!st.hasMoreElements())
			st = new StringTokenizer(in.readLine());

		return st.nextToken();
	}
	private static void begin() {
		out = new PrintWriter(new OutputStreamWriter(System.out));
		st = new StringTokenizer("");
		in = new BufferedReader(new InputStreamReader(System.in));
	}

}

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class D {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong(), r = sc.nextLong();

		long ans = 0;
		boolean flg = false;
		for(int i=63;i>=0;i--) {
			 flg |= ((l>>>i)&1) != ((r>>>i)&1);
			 ans |= flg? 1L<<i: 0;
		}
		System.out.println(ans);
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

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

import java.util.Scanner;

public class LittleGirlAndMaximumXOR {
	public static void main(String [] args){
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		long d = r - l;
		char[] lc = Long.toBinaryString(l).toCharArray();
		char[] rc = Long.toBinaryString(r).toCharArray();
		long [] p = new long[rc.length];
		p[0]=1;
		for(int i= 1 ; i < p.length ;i++){
			p[i]=2*p[i-1];
		}
		long ans = 0;
		for(int i = rc.length - lc.length - 1 ; i > -1 ;i--){
				ans+=p[rc.length-1-i];
		}
		int dd = rc.length - lc.length;
		for(int i = 0 ; i < lc.length ; i++){
			if(rc[i+dd]!=lc[i]){
				ans+=p[lc.length-1-i];
			}
			else{
				if(d-p[lc.length-1-i]>0){
					d-=p[lc.length-1-i];
					ans+=p[lc.length-1-i];
				}
			}
		}
		System.out.println(ans);

	}
}

//package que_a;

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

public class utkarsh {

    InputStream is;
    PrintWriter out;

    long mod = (long) (1e9 + 7), inf = (long) (3e18);

    void solve() {
        long l = nl(), r = nl();
        long a = 0, b = 0, x = (1L << 60L);
        for( ; x > 0; x >>= 1) {
            if(a+x > r && b+x > r)  continue;
            if(a+x > r) {
                b += x;
            } else if(b+x > r) {
                a += x;
            } else {
                if(a+x-1 < l && b+x-1 < l) {
                    a += x;     b += x;
                } else if(a+x-1 < l) {
                    a += x;     b += x-1;
                    break;
                } else if(b+x-1 < l) {
                    b += x;     a += x-1;
                    break;
                } else {
                    if(a < b)   a += x;
                    else        b += x;
                }
            }
        }
        out.println(a ^ b);
    }

    long mp(long b, long e) {
        long r = 1;
        while(e > 0) {
            if((e&1) == 1)  r = (r * b) % mod;
            b = (b * b) % mod;
            e >>= 1;
        }
        return r;
    }

    //---------- I/O Template ----------

    public static void main(String[] args) { new utkarsh().run(); }
    void run() {
        is = System.in;
        out = new PrintWriter(System.out);
        solve();
        out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte() {
        if(ptr >= len) { ptr = 0;
            try { len = is.read(input); }
            catch(IOException e) { throw new InputMismatchException(); }
            if(len <= 0) { return -1; }
        } return input[ptr++];
    }
    boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
    int skip() {
        int b = readByte();
        while(b != -1 && isSpaceChar(b)) { b = readByte(); }
        return b;
    }

    char nc() { return (char)skip(); }
    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    String nLine() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    int ni() {
        int n = 0, b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        if(b == -1) { return -1; }  //no input
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }
    long nl() {
        long n = 0L;    int b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }

    double nd() { return Double.parseDouble(ns()); }
    float nf() { return Float.parseFloat(ns()); }
    int[] na(int n) {
        int a[] = new int[n];
        for(int i = 0; i < n; i++) { a[i] = ni(); }
        return a;
    }
    char[] ns(int n) {
        char c[] = new char[n];
        int i, b = skip();
        for(i = 0; i < n; i++) {
            if(isSpaceChar(b)) { break; }
            c[i] = (char)b; b = readByte();
        } return i == n ? c : Arrays.copyOf(c,i);
    }
}

import java.io.*;
import java.util.*;
public final class little_girl_xor
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static long maxn=(long)(1e18)+3;
	static List<Long> list=new ArrayList<Long>();

	static long solve(long l1,long r1,long l2,long r2,int idx)
	{
		if(idx<0)
		{
			return 0;
		}
		long max=0;
		/*
		for(int i=idx;i>=0;i--)
		{
			if(l1<list.get(i) && r2>=list.get(i))
			{
				max=(list.get(i)+solve(l1,Math.min(r1,list.get(i)-1),Math.max(l2,list.get(i))-list.get(i),r2-list.get(i),i-1));
			}
		}
		*/
		for(int i=idx;i>=0;i--)
		{
			if(l2<list.get(i) && r1>=list.get(i))
			{
				max=Math.max(max,list.get(i)+solve(Math.max(l1,list.get(i))-list.get(i),r1-list.get(i),l2,Math.min(r2,list.get(i)-1),i-1));break;
			}
		}
		if(max!=0)
		{
			return max;
		}
		return solve(l1,l2,r1,r2,idx-1);
	}

    public static void main(String args[]) throws Exception
    {
		long l=sc.nextLong(),r=sc.nextLong();
		for(long curr=1;curr<maxn;curr*=2)
		{
			list.add(curr);
		}
		long max=0;
		for(int i=list.size()-1;i>=0;i--)
		{
			if(list.get(i)>r)
			{
				continue;
			}
			if(l<list.get(i) && r>=list.get(i))
			{
				max=list.get(i)+solve(l,list.get(i)-1,0,r-list.get(i),i-1);break;
			}
			l-=list.get(i);r-=list.get(i);
		}
		out.println(max);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

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

public class LittleGirlAndMaximumXOR {
    private static boolean debug = false;

    private static long L, R;

    private static void solveProblem(InputStream instr) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(instr)));
        int testCount = 1;
        if (debug) {
            testCount = sc.nextInt();
        }

        for (int t = 1; t <= testCount; t++) {
            printDebug("------ " + t + " ------");
            L = sc.nextLong();
            R = sc.nextLong();
            Object result = solveTestCase();
            System.out.println(result);
        }
    }

    public static String lpad(String str, int num, char ch) {
        return String.format("%1$" + num + "s", str).replace(' ', ch);
    }

    private static Object solveTestCase() {
        int count = 0;
        if (L == R) {
            return 0;
        }
        String left = Long.toBinaryString(L);
        String right = Long.toBinaryString(R);
        printDebug(left);
        printDebug(right);
        int X = right.length();
        if (left.length() == right.length()) {
            for (int i = 0; i < left.length(); i++) {
                if (left.charAt(i) == right.charAt(i)) {
                    X--;
                } else {
                    break;
                }
            }
        }
        long num = (1L << X) - 1;
        return num;
    }

    private static int[] readInts(Scanner sc, int N) {
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        return arr;
    }

    private static String joinValues(List<? extends Object> list, String delim) {
        return list.stream().map(Object::toString).collect(Collectors.joining(delim));
    }

    public static void printDebug(Object str) {
        if (debug) {
            System.out.println("DEBUG: " + str);
        }
    }

    public static void main(String[] args) throws Exception {
        long currTime = System.currentTimeMillis();
        if (debug) {
            solveProblem(new FileInputStream(new File("input.in")));
            System.out.println("Time: " + (System.currentTimeMillis() - currTime));
        } else {
            solveProblem(System.in);
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class D {

	static class Scanner{
		BufferedReader br=null;
		StringTokenizer tk=null;
		public Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		public String next() throws IOException{
			while(tk==null || !tk.hasMoreTokens())
				tk=new StringTokenizer(br.readLine());
			return tk.nextToken();
		}
		public int nextInt() throws NumberFormatException, IOException{
			return Integer.valueOf(next());
		}
		public long nextLong() throws NumberFormatException, IOException{
			return Long.valueOf(next());
		}
		public double nextDouble() throws NumberFormatException, IOException{
			return Double.valueOf(next());
		}
	}

	public static void main(String args[]) throws NumberFormatException, IOException{
		Scanner sc=new Scanner();
		long a=sc.nextLong();
		long b=sc.nextLong();
		int index=-1;
		for(int i=63; i>=0 ;i--){
			long f = ((a>>i)&1);
			long s = ((b>>i)&1);
			if (f != s){
				index = i;
				break;
			}
		}
		//System.out.println("dbg "+index);
		if (index==-1)
			System.out.println("0");
		else{
			long val = 1L<<index;
			System.out.println( val | (val - 1));
		}
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class LittleGirlAndMaximumXOR {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		for(int i = 8; i <= 16; i++)
		{
			for(int j = i; i <= 16; i++)
			{

			}
		}

//		sc.useRadix(2);
		long l = sc.nextLong();
		long r = sc.nextLong();

		String sl = Long.toBinaryString(l);
		String sr = Long.toBinaryString(r);

		boolean[] a = new boolean[60];
		boolean[] b = new boolean[60];
		boolean[] c = new boolean[60];

		int d = 0;
		for(int i = sl.length()-1; i >= 0; i--)
		{
			a[59-d] = sl.charAt(i) == '1';
			d++;
		}

//		System.out.println(sr);
//		System.out.println(sl);

		d = 0;
		for(int i = sr.length()-1; i >= 0; i--)
		{
			b[59-d] = sr.charAt(i) == '1';
			d++;
		}

		int leftera = -1;
		int lefterb = -1;

		for(int i = 0; i < 60; i++)
		{
			if(leftera == -1 && a[i])
				leftera = i;
			if(lefterb == -1 && b[i])
				lefterb = i;
		}

//		System.out.println(Arrays.toString(a));
//		System.out.println(Arrays.toString(b));

//		System.out.println(leftera + " " + lefterb);

	//	System.out.println("Lefterb " + lefterb + ", a " + leftera);
		{
			boolean armageddon = false;
			for(int i = lefterb; i < 60; i++)
			{
				if(!armageddon)
				{
					if(b[i] == a[i])
					{
						c[i] = false;
					}
					else
					{
						armageddon = true;
						c[i] = true;
					}
				}
				else
				{
					c[i] = true;
				}

			}
		}

		long res = 0;

		for(int i = 0; i < 60; i++)
		{
			if(c[i])
			{
				long cur = 1;
				for(int k = 1; k <= 59-i; k++)
				{
					cur *= 2;
				}
	//			if(c[i])
	//				res += Math.pow(2, 59-i);
				res += cur;
			}
		}
//		System.out.println(Arrays.toString(c));

		System.out.println(res);

	}

}

import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);

		long l=s.nextLong();
		long r=s.nextLong();

		if(l==r)
		{
			System.out.println(0);
			return;
		}

		int p=0;

		while(p==0)
		{
			long res=1;

			while(2*res<=r)
			{
				res=res*2;
			}

			if(res-1>=l)
			{
				p=1;
				System.out.println(res^(res-1));
				break;
			}
			else
			{
				l=l-res;
				r=r-res;
			}

		}

	}

}

import java.math.BigInteger;
import java.util.Scanner;

public class Codeforce276D {
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);
        long l=scn.nextLong();
        long r=scn.nextLong();
        if(l==r){
            System.out.println(0);
        }
        else{
            String string1="", string2="";
            while(l!=0){
                if(l%2==0){
                    string1="0"+string1;
                }
                else{
                    string1="1"+string1;
                }
                l=l/2;
            }
            while(r!=0){
                if(r%2==0){
                    string2="0"+string2;
                }
                else{
                    string2="1"+string2;
                }
                r=r/2;
            }
            if(string1.length()!=string2.length()){
                BigInteger ans=new BigInteger("2");
                int max=Math.max(string1.length(), string2.length());

                ans = ans.pow(max);
                ans = ans.subtract(new BigInteger("1"));
                System.out.println(ans);
            }
            else{
                for(int i=0;i<string1.length();i++){
                    if(string1.charAt(i)!=string2.charAt(i)){

                        BigInteger ans=new BigInteger("2");
                        int max=string1.length()-i;

                        ans = ans.pow(max);
                        ans = ans.subtract(new BigInteger("1"));
                        System.out.println(ans);
                        break;
                    }
                }
            }
        }
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main
{
	public static void main(String[] args)
    throws IOException
	{

        BufferedReader reader = new BufferedReader(
            new InputStreamReader(System.in));

        String []arr = reader.readLine().split(" ");
        long x,y;
        x = Long.parseLong(arr[0]);
        y = Long.parseLong(arr[1]);

        if((x ^ y) == 0)
            System.out.println(0);
        else
        {

            //System.out.println(1L<<63);
            long maxLong = 1L << 62;

            while((x & maxLong) == (y & maxLong))
            {
                maxLong >>= 1;
            }

            System.out.println((maxLong << 1) - 1);

        }

    }
}

import java.util.Scanner;

public class D {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long L = in.nextLong(), R = in.nextLong();
        for (int i = 61; i >= 0; i--) {
            boolean a = (((L >> i) & 1) == 1), b = (((R >> i) & 1) == 1);
            if (a & b) {
                // 1, 1
                if ((R ^ (1L << i)) >= L)
                    R = (R ^ (1L << i));
            } else if(!a & !b){
                // 0, 0
                if ((L ^ (1L << i)) <= R)
                    L = (L ^ (1L << i));
            }
        }

        System.out.println(L ^ R);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class LittleGirlandMaximumXOR {

	static long l, r;
	static long[][] dp;

	static boolean bit(long x, int i) {
		return (x & (1L << (long) i)) != 0;
	}

	static long solve(int i, int a, int b, int c, int d) {
		if (i == -1)
			return 0;
		int mask = (a << 3) | (b << 2) | (c << 1) | d;
		if (dp[i][mask] != -1)
			return dp[i][mask];
		long ans = 0;
		boolean bl = bit(l, i);
		boolean br = bit(r, i);
		// 0 0
		if ((a == 1 || !bl) && (c == 1 || !bl))
			ans = solve(i - 1, a, br ? 1 : b, c, br ? 1 : d);
		// 1 1
		if ((b == 1 || br) && (d == 1 || br))
			ans = Math.max(ans, solve(i - 1, !bl ? 1 : a, b, !bl ? 1 : c, d));
		// 0 1
		if ((a == 1 || !bl) && (d == 1 || br))
			ans = Math.max(
					ans,
					(1L << (long) i)
							+ solve(i - 1, a, br ? 1 : b, !bl ? 1 : c, d));
		// 1 0
		if ((b == 1 || br) && (c == 1 || !bl))
			ans = Math.max(
					ans,
					(1L << (long) i)
							+ solve(i - 1, !bl ? 1 : a, b, c, br ? 1 : d));
		return dp[i][mask] = ans;
	}

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		l = nxtLng();
		r = nxtLng();
		dp = new long[61][1 << 4];
		for (long[] a : dp)
			Arrays.fill(a, -1);
		out.println(solve(60, 0, 0, 0, 0));
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

  static class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new
          InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

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

    String[] nextSArray() {
      String sr[] = null;
      try {
        sr = br.readLine().trim().split(" ");
      } catch (IOException e) {
        e.printStackTrace();
      }
      return sr;
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }

      return str;
    }
  }

  //  static int MOD=1000000000+7;
//  public static void sortbyCol(int arr[][],int col)
//  {
//    Arrays.sort(arr,new Comparator<int[]>(){
//      @Override
//      public int compare(int[] o1, int[] o2) {
//        // To sort in descending order revert
//        // the '>' Operator
//        if(o1[col]>o2[col])
//          return 1;
//        else
//          return -1;
//      }
//    });
//  }

  public static void main(String[] args) throws java.lang.Exception {
    FastReader sc = new FastReader();
//   int t1=sc.nextInt();
//   for(int t=0;t<t1;++t)
//   {
//
//
//   }
    int a=sc.nextInt();
    int b=sc.nextInt();
    if(a==b)
    {
      out.println(0);
      return;
    }
    int bit=(int) Math.pow(2,10);
    int x=0,y=0;
    while(bit>0)
    {
      if((a&bit)!=(b&bit))
      {
        break;
      }
      bit=bit>>1;
    }
    int ans=bit|(bit-1);
    out.println(ans);
    out.flush();
    out.close();

  }

}

// out.println(al.toString().replaceAll("[\\[|\\]|,]",""));

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Problem4 {
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		long l = sc.nextLong();
		long r = sc.nextLong();

		if(l == r){
			System.out.println(0);
			return;
		}
		long lLength = countBinLength(l);
		long rLength = countBinLength(r);

		if(rLength == lLength){
			System.out.println(r);
			return;
		}

		long val = exp(2,rLength)-1;
		System.out.println(val);

	}

	public static long exp(long a, long n){
		if(n==0){
			return 1;
		}

		if(n % 2 == 0){
			long r = exp(a, n/2);
			return (r*r);
		}else{
			return (a * exp(a,n-1));
		}
	}

	public static long countBinLength(long value) {
	    return Long.SIZE-Long.numberOfLeadingZeros(value);
	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {

    /**
     * @param args
     */

     BufferedReader in;
        PrintWriter out = new PrintWriter(System.out);
        StringTokenizer tok;

         String readToken() throws IOException { // reads the token; to read a full line use in.readLine()
        while (tok == null || !tok.hasMoreTokens()) {
        tok = new StringTokenizer(in.readLine());

        }
        return tok.nextToken(); // sometimes it's better to use nextToken(String) method here
        }
         int readInt() throws IOException { // write readDouble(), readLong(), readBigInteger() methods if necessary
        return Integer.parseInt(readToken());
        }
         public String readLine() throws IOException{
            return in.readLine();

         }
         long readLong() throws IOException { // write readDouble(), readLong(), readBigInteger() methods if necessary
                return Long.parseLong(readToken());
                }
         double readDouble() throws IOException { // write readDouble(), readLong(), readBigInteger() methods if necessary
                return Double.parseDouble(readToken());
                }
        public static void main(String[] args) throws IOException
        {
           new Main().run();
        }
        void run() throws IOException
        {
            out = new PrintWriter(new OutputStreamWriter(System.out));
            in = new BufferedReader(new InputStreamReader(System.in));

           solve();
           out.flush();
           tok=null;
        }

        void solve() throws IOException{
            /*
             * an L==R, apantisi 0
             * Alliws,
             * birskw to prwto psifio(Diadiko) sto opoio to
             * R=1 && L=0 {epeidi R>L kai ola ta psifia pio prin einai idia, kapoia
             * stigmi to R tha ehei ena psifio pou na einai 1 esti wste an kseroume pws einai megaliter} (1)
             * h apantisi twra einai 2^(thesi_psifiou+1)-1
             * (gtp)apodeiksi me epagwgi:
             * estw pws isxie gia n bits
             * gia n+1 bits:
             *
             * ean ehoume 1|0 i 0|1 ta afinoume opws einai
             * an einai 1|1  therwoume oti eixame 0|1 gia na ginei 1
             * an eina 0|0  borw na kanw 0|1 {afou kserw oti gia paw apo to 0 sto 1{pou anefera sto (1) tha perasw sgr apo 1 kapoia stigmi sta
             * deksia mou iti ti twrinim mou thesi}
             * Epomenws oti kai na ginei to psifio auto tha einai 1
             * ola ta proigoumena eina 1 apo to thesi_psifiou kai epeita
             * ara ehoume athroizontas 2^(Thesi_psifiou+1)-1
             */
            long l=readLong();
            long r=readLong();
            if (l==r){
                out.println(0);
            }else{
                long lr=l^r;
                long p=(long)Math.ceil(Math.log(lr)/Math.log(2));
                out.println((long)Math.pow(2,p)-1);
            }

        }

}

//Little Girl and Maximum XOR
import java.io.*;
import java.util.*;
import java.lang.*;

public class D276{

   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);

      StringTokenizer st = new StringTokenizer(f.readLine());

      long n = Long.parseLong(st.nextToken());                //n is lower
      long m = Long.parseLong(st.nextToken());                //m is upper
      long lower = n;
      long upper = m;

      String nb = Long.toBinaryString(n);
      String mb = Long.toBinaryString(m);
      int len = mb.length();

      String add0 = "";
      for(int k = nb.length(); k < len; k++) add0+="0";

      nb = add0 + nb;

      long answer = 0L;
      int index = 0;
      while(index<len && nb.charAt(index) == '1' && mb.charAt(index) == '1'){
         index++;
         answer+=(long)Math.pow(2,len-index-1);
      }

      for(int k = index; k < len; k++){
         char a = mb.charAt(k);                       //a is upper
         char b = nb.charAt(k);                       //b is lower

         long i = (long)Math.pow(2,len-k-1);
         if(a!=b) answer+=i;

         if(a=='0' && b=='0'){
            if(lower+i<=m){
               lower+=i;                              //change 0 to 1 on lower
               answer+=i;
            }
         }
         if(a=='1' && b=='1'){
            if(upper-i>=n){
               upper-=i;                              //change 1 to 0 on upper
               answer+=i;
            }
         }
      }

      out.println(answer);

      out.close();
   }

}

/*  convert each # to binary, subtract the two
if number is <= 11, print number
else, is the difference as all 1s, convert back to base 10
*/

import java.util.*;

public class LittleGirlMaxXOR
{
	public static final double START_BASE = 10;
	public static final double FINAL_BASE = 2;
	public static final int CUTOFF = 11;

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int l = in.nextInt();
		int r = in.nextInt();
		// check for exceptions in lines above

		long l2Bin = convert2Bin(l, 0);
		long r2Bin = convert2Bin(r, 0);

		long diff = r2Bin ^ l2Bin;

		if (diff <= CUTOFF)
		{
			long ans = Long.parseLong(Long.toString(diff),(int) FINAL_BASE);
			System.out.println(ans);
		}
		else
		{
			System.out.println(diff);
			/*convert to string, then change every digit to 1, convert to decimal*/
			long ans = 0;
			for (double i = 0; i < String.valueOf(Long.toString(diff)).length(); i++)
			{
				ans += (long) Math.pow(START_BASE,i);
			}
			System.out.println(ans);
			ans = Long.parseLong(Long.toString(ans),(int) FINAL_BASE);
			System.out.println(ans);
		}
	}

	public static int convert2Bin(int rem, int bin)
	{
		double exp = 0;
		if (rem > 1)
		{
			int temp = rem;
			while (temp > FINAL_BASE-1)
			{
				temp = temp/(int) FINAL_BASE;
				exp++;
			}
			bin = bin + (int) Math.pow(START_BASE,exp);
			rem = rem % (int) (Math.pow(FINAL_BASE,exp));
			return convert2Bin(rem,bin);
		}
		else
		{
			return bin + rem;
		}

	}

}

import java.io.*;
import java.io.ObjectInputStream.GetField;
import java.math.*;
import java.util.*;

/**
 *
 * @author Saju
 *
 */

public class Main {

	private static int dx[] = { -2, -3, -2, -1, -1, 1};
	private static int dy[] = { 1, -1, -1, -2, -3, -2};

	private static final long INF = (long) (1e15);
	private static final long NEG_INF = Long.MIN_VALUE;
	private static final double EPSILON = 1e-10;

	private static final int MAX = 1007;
	private static final int MOD = 10007;

	private static final int MAXN = 100007;
	private static final int MAXA = 10000009;
	private static final int MAXLOG = 22;

	public static void main(String[] args) {

		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

/*

*/

		twoPowers[0] = 1;
		for(int i = 1; i < 63; i++) {
			twoPowers[i] = twoPowers[i - 1] * 2;
//			System.out.println(i + " " + twoPowers[i]);
		}

//		System.out.println(log(2, 2));
//
//		int l = 24;
//		int r = 63;
//
//		int max = 0;
//		int a = 0;
//		int b = 0;
//		for(int i = l; i <= r; i++) {
//			for(int j = i; j <= r; j++) {
//				int v = i ^ j;
//				if(max < v) {
//					max = v;
//					a = i;
//					b = j;
//				}
//			}
//		}
//
//		System.out.println(max + " " + a + " " + b);

		long l = in.nextLong();
		long r = in.nextLong();

		long ans = call(l, r);

		out.println(ans);

//		out.println();

		out.flush();
		out.close();
		System.exit(0);
	}

	private static long call(long l, long r) {

		if(l == r) {
			return 0;
		}
//		else if(l + 1 == r) {
//			return 1;
//		}
		int loga = log(l, 2);
		int logb = log(r, 2);
//		System.out.println(loga + " " + logb);

		if(twoPowers[logb] <= l && twoPowers[logb] <= r) {
			long div = r - twoPowers[logb];
			int logdiv = log(div, 2);

			return twoPowers[logdiv + 1] - 1;
		}

//		if(l <= twoPowers[logb] - 1) {
			return twoPowers[logb + 1] - 1;
//		}

	}

	static long twoPowers[] = new long[63];

	private static class Pair<T>{
		T a;
		T b;
		Pair(T a, T b){
			this.a = a;
			this.b = b;
		}
	}

	private static class SegmentTree{
		int n;
		private final int MAXN = 100007;
		private long[] tree = new long[MAXN << 2];
		private long[] lazy = new long[MAXN << 2];
		private long[] arr = new long[MAXN];

		/***
		 *
		 * arr is 1 based index.
		 *
		 * @param arr
		 *
		 */
		SegmentTree(int n, long[] arr){
			this.n = n;
			for(int i = 0; i < arr.length; i++) {
				this.arr[i] = arr[i];
			}
		}

		void build(int index, int left, int right) {
			if(left == right) {
				tree[index] = arr[left];
			}
			else {
				int mid = (left + right) / 2;

				build(index * 2, left, mid);
				build((index * 2) + 1, mid + 1, right);
				tree[index] = max(tree[(index * 2)], tree[(index * 2) + 1]);
			}
		}

		long query(int node, int left, int right, int start, int end) {

			if(left > end || right < start) {
				return NEG_INF;
			}

			if(left >= start && right <= end) {
				return tree[node];
			}
			int mid = (left + right) / 2;
			long val1 = query(2 * node, left, mid, start, end);
			long val2 = query(2 * node + 1, mid + 1, right, start, end);

			return max(val1, val2);
		}

		void update(int node, int left, int right, int idx, long val) {
			if(left == right) {
				tree[node] += val;
			}
			else {
				int mid = (left + right) / 2;
				if(idx <= mid) {
					update(2 * node, left, mid, idx, val);
				}
				else {
					update(2 * node + 1, mid + 1, right, idx, val);
				}
				tree[node] = max(tree[(2 * node) + 1], tree[(2 * node)]);
			}
		}

		 void updateRange(int node, int start, int end, int l, int r, long val)
		{
		    if(lazy[node] != 0)
		    {
		        // This node needs to be updated
		        tree[node] =  lazy[node];    // Update it
		        if(start != end)
		        {
		            lazy[node*2] = lazy[node];                  // Mark child as lazy
		            lazy[node*2+1] = lazy[node];                // Mark child as lazy
		        }
		        lazy[node] = 0;                                  // Reset it
		    }
		    if(start > end || start > r || end < l)              // Current segment is not within range [l, r]
		        return;
		    if(start >= l && end <= r)
		    {
		        // Segment is fully within range
		        tree[node] =  val;
		        if(start != end)
		        {
		            // Not leaf node
		            lazy[node*2] = val;
		            lazy[node*2+1] = val;
		        }
		        return;
		    }
		    int mid = (start + end) / 2;
		    updateRange(node*2, start, mid, l, r, val);        // Updating left child
		    updateRange(node*2 + 1, mid + 1, end, l, r, val);   // Updating right child
		    tree[node] = max(tree[node*2], tree[node*2+1]);        // Updating root with max value
		}

		 long queryRange(int node, int start, int end, int l, int r)
		{
		    if(start > end || start > r || end < l)
		        return 0;         // Out of range
		    if(lazy[node] != 0)
		    {
		        // This node needs to be updated
		        tree[node] =  lazy[node];            // Update it
		        if(start != end)
		        {
		            lazy[node*2] = lazy[node];         // Mark child as lazy
		            lazy[node*2+1] = lazy[node];    // Mark child as lazy
		        }
		        lazy[node] = 0;                 // Reset it
		    }
		    if(start >= l && end <= r)             // Current segment is totally within range [l, r]
		        return tree[node];
		    int mid = (start + end) / 2;
		    long p1 = queryRange(node*2, start, mid, l, r);         // Query left child
		    long p2 = queryRange(node*2 + 1, mid + 1, end, l, r); // Query right child
		    return max(p1, p2);
		}

		 void buildRange(int node, int low, int high){
			if(low == high){
				tree[node] =  arr[low];
				return;
			}

			int mid = (low + high) / 2;
			int left = node << 1;
			int right = left | 1;
			buildRange(left, low, mid);
			buildRange(right, mid + 1, high);
			tree[node] = max(tree[left], tree[right]);
		}

		void printSegmentTree() {
			System.out.println(Arrays.toString(tree));
		}

	}

	private static class KMP{

		private static char[] t;
		private static char[] s;

		public int kmp(char[]t, char[]s) {
			this.t = t;
			this.s = s;
			return this.kmp();
		}

		private int kmp() {

			List<Integer> prefixTable = getPrefixTable(s);

			int match = 0;
			int i = 0;
			int j = 0;

			int n = t.length;
			int m = s.length;
			while(i < n) {
				if(t[i] == s[j]) {
					if(j == m - 1) {
						match++;
						j = prefixTable.get(j - 1);
						continue;
					}
					i++;
					j++;
				}
				else if(j > 0) {
					j = prefixTable.get(j - 1);
				}
				else {
					i++;
				}
			}

			return match;
		}

		/***
		1. We compute the prefix values π[i] in a loop by iterating

				from i=1 to i=n−1 (π[0] just gets assigned with 0).

		2. To calculate the current value π[i] we set the variable j

				denoting the length of the best suffix for i−1. Initially j=π[i−1].

		3. Test if the suffix of length j+1 is also a prefix by

				comparing s[j] and s[i]. If they are equal then we assign π[i]=j+1,

				otherwise we reduce j to π[j−1] and repeat this step.

		4. If we have reached the length j=0 and still don't have a match,

				then we assign π[i]=0 and go to the next index i+1.

		@param
	 	pattern(String)
	***/
		private List<Integer> getPrefixTable(char[] pattern){

			List<Integer> prefixTable = new ArrayList<Integer>();
			int n = pattern.length;
			for(int i = 0; i < n; i++) {
				prefixTable.add(0);
			}

			for(int i = 1; i < n; i++) {
				for(int j = prefixTable.get(i - 1); j >= 0;) {
					if(pattern[j] == pattern[i]) {
						prefixTable.set(i, j + 1);
						break;
					}
					else if(j > 0){
						j = prefixTable.get(j - 1);
					}
					else {
						break;
					}
				}
			}

			return prefixTable;
		}
	}

	private static class Point {
		long x;
		long y;
		Point(long x, long y){
			this.x = x;
			this.y = y;
		}

		@Override
		public boolean equals(Object obj) {
			Point ob = (Point) obj;
			if(this.x == ob.x && this.y == ob.y){
				return true;
			}
			return false;
		}
		@Override
		public String toString() {
			return this.x + " " + this.y;
		}
	}

	private static int pow(int base, int pow) {
		int val = 1;
		for(int i = 1; i <= pow; i++) {
			val *= base;
		}
		return val;
	}

	private static int log(int x, int base) {
		return (int) (Math.log(x) / Math.log(base));
	}
	private static int log(long x, int base) {
		return (int) (Math.log(x) / Math.log(base));
	}
	private static long max(long a, long b) {
		if (a >= b) {
			return a;
		}
		return b;
	}

	private static long abs(long a) {
		if (a < 0) {
			return -a;
		}
		return a;
	}

	private static int abs(int a) {
		if (a < 0) {
			return -a;
		}
		return a;
	}

	private static int max(int a, int b) {
		if (a >= b) {
			return a;
		}
		return b;
	}

	private static int min(int a, int b) {
		if (a <= b) {
			return a;
		}
		return b;
	}

	private static long min(long a, long b) {
		if (a <= b) {
			return a;
		}
		return b;
	}

	private static long gcd(long a, long b) {
		if (b == 0) {
			return a;
		}
		return gcd(b, a % b);
	}

	private static int gcd(int a, int b) {
		if (b == 0) {
			return a;
		}
		return gcd(b, a % b);
	}

	private static long bigMod(long n, long k, long m) {

		long ans = 1;
		while (k > 0) {
			if ((k & 1) == 1) {
				ans = (ans * n) % m;
			}
			n = (n * n) % m;
			k >>= 1;
		}
		return ans;
	}

	/*
	 * Returns an iterator pointing to the first element in the range [first,
	 * last] which does not compare less than val.
	 *
	 */
	private static int lowerBoundNew(long[] arr, long num) {
		int start = 0;
		int end = arr.length - 1;
		int index = 0;
		int len = arr.length;
		int mid = 0;
		while (true) {
			if (start > end) {
				break;
			}
			mid = (start + end) / 2;
			if (arr[mid] > num) {
				end = mid - 1;
			} else if (arr[mid] < num) {
				start = mid + 1;
			} else {
				while (mid >= 0 && arr[mid] == num) {
					mid--;
				}
				return mid + 1;
			}
		}
		if (arr[mid] < num) {
			return mid + 1;
		}
		return mid;
	}

	/*
	 * upper_bound() is a standard library function in C++ defined in the header
	 * . It returns an iterator pointing to the first element in the range
	 * [first, last) that is greater than value, or last if no such element is
	 * found
	 *
	 */
	private static int upperBoundNew(long[] arr, long num) {

		int start = 0;
		int end = arr.length - 1;
		int index = 0;
		int len = arr.length;
		int mid = 0;
		while (true) {
			if (start > end) {
				break;
			}
			mid = (start + end) / 2;
			if (arr[mid] > num) {
				end = mid - 1;
			} else if (arr[mid] < num) {
				start = mid + 1;
			} else {
				while (mid < len && arr[mid] == num) {
					mid++;
				}
				if (mid == len - 1 && arr[mid] == num) {
					return mid + 1;
				} else {
					return mid;
				}
			}
		}
		if (arr[mid] < num) {
			return mid + 1;
		}
		return mid;
	}

	private static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}

		public String next() {
			try {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					tokenizer = new StringTokenizer(reader.readLine());

				}
			} catch (IOException e) {
				return null;
			}
			return tokenizer.nextToken();
		}

		public String nextLine() {
			String line = null;
			try {
				tokenizer = null;
				line = reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			return line;
		}

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

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

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

		public boolean hasNext() {
			try {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					tokenizer = new StringTokenizer(reader.readLine());
				}
			} catch (Exception e) {
				return false;
			}
			return true;
		}
	}
}

import java.util.*;
import java.math.*;
import java.io.*;
 import java.text.DecimalFormat;
public class Main{
    static int[] arr;
    static String h;
    public static void main(String[] args)  throws IOException {
        s.init(System.in);
        PrintWriter out = new PrintWriter(System.out);

        long a,b;
        String x,y,z1,z2;
        a=s.nextLong();
        b=s.nextLong();
        y=Long.toBinaryString(b);
        x=Long.toBinaryString(a);

        while(x.length()<y.length())
            x="0"+x;
        int flag1,flag2;
        flag1=flag2=0;
        long v1,v2;
        v1=v2=0;
        z1=z2="";
        long p=(long)Math.pow(2,x.length()-1);
        for(int i=0;i<y.length();i++){
            char c,d;
            c=x.charAt(i);
            d=y.charAt(i);
            if(c!=d){
                if(c==0){
                    if(v1+p-1>=a){
                        z1=z1+"0";
                        if(v2+p<=b){
                            z2=z2+"1";
                            v2+=p;
                        }
                        else{
                            z2=z2+"0";
                        }

                    }

                    else{
                        z1=z1+"1";
                        v1+=p;
                        if(v2+p-1>=a){
                            z2=z2+"0";

                        }
                        else{
                            z2=z2+"1";
                            v2+=p;
                        }

                    }

                }
                else if(v2+p-1>=a){
                        z2=z2+"0";
                        if(v1+p<=b){
                            z1=z1+"1";
                            v1+=p;
                        }
                        else{
                            z1=z1+"0";
                        }

                    }

                    else{
                        z2=z2+"1";
                        v2+=p;
                        if(v1+p-1>=a){
                            z1=z1+"0";

                        }
                        else{
                            z1=z1+"1";
                            v1+=p;
                        }

                    }

                }

            else if(c=='0'&&d=='0'){
                if(((v2+p)<=b)){
                    z1=z1+""+'0';
                    z2=z2+""+'1';
                    v2+=p;
                }
                else if(((v1+p)<=b)){
                    z1=z1+""+'1';
                    z2=z2+""+'0';
                    v1+=p;
                }

                else{
                    z1=z1+"0";
                    z2=z2+"0";
                }

            }
            else{
                if(((v1+p-1)>=a)){
                    z1=z1+""+'0';
                    z2=z2+""+'1';
                    v2+=p;
                }
                else if(((v2+p-1)>=a)){
                    z1=z1+""+'1';
                    z2=z2+""+'0';
                    v1+=p;
                }
                else{
                    z1=z1+"1";
                    z2=z2+"1";
                }

            }
            p/=2;
        }

        System.out.println(Long.parseLong(z1,2)^Long.parseLong(z2,2));
    }
    static class paint implements Comparable<paint>{
        int clr;
        HashSet<Integer> hs;
        public paint(int x){
            clr=x;
            hs=new HashSet<Integer>();
        }
        public  int compareTo(paint o){
            if(o.hs.size()!=hs.size())
                return o.hs.size()-hs.size();
            else
                return clr-o.clr;
            }
    }
    public static int pow(int x,int y){
        int ans=1;
        while(y>0){
            if(y%2==1)
                ans*=x;
            x*=x;

            y/=2;

        }
        return ans;
    }
    public static class s {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /** call this method to initialize reader for InputStream */
        static void init(InputStream input) {
            reader = new BufferedReader(
                        new InputStreamReader(input) );
            tokenizer = new StringTokenizer("");
        }

        /** get next word */
        static String next() throws IOException {
            while ( ! tokenizer.hasMoreTokens() ) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                    reader.readLine() );
            }
            return tokenizer.nextToken();
        }

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

        static double nextDouble() throws IOException {
            return Double.parseDouble( next() );
        }
        static long nextLong() throws IOException {
            return Long.parseLong( next() );
        }

    }
}

import java.util.*;
public class YES {
	public static void main(String[] args) {
		Scanner bahy = new Scanner(System.in);
		long min = bahy.nextLong();
		long max = bahy.nextLong();
		int xMax =(int)(Math.log(max)/Math.log(2));
		int xMin =(int)(Math.log(min)/Math.log(2));
		if(min==max)
		{
			System.out.println(0);
		}
		else
		{
		while(xMax==xMin)
		{
			max-=Math.pow(2,xMax);
			min-=Math.pow(2,xMin);
			 xMax =(int)(Math.log(max)/Math.log(2));
			 xMin =(int)(Math.log(min)/Math.log(2));
		}

			long Ans=(long) (Math.pow(2, xMax+1)-1);

			System.out.println(Ans);
		}

	}

}

/**
 * ******* Created  on 8/12/19 6:35 AM*******
 */

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

public class D276 implements Runnable {

    private static final int MAX = (int) (1E5 + 5);
    private static final int MOD = (int) (1E9 + 7);
    private static final int Inf = (int) (1E9 + 10);

    private void solve() throws IOException {
        long l = reader.nextLong();
        long r = reader.nextLong();
        long ans = 0;
        for(long i = 62; i>=0;i--){
            if(r >= (1L<<i) && (1L<<(i) -1) >=l){
                ans |= (1L<<i);
                ans |= ( (1L<<i )-1);
                break;
            }else if((1L<<i)<=l){
                l -= (1L<<i);
                r -= (1L<<i);
            }
        }
        writer.print(ans);
    }

    public static void main(String[] args) throws IOException {
        try (Input reader = new StandardInput(); PrintWriter writer = new PrintWriter(System.out)) {
            new D276().run();
        }
    }

    StandardInput reader;
    PrintWriter writer;

    @Override
    public void run() {
        try {
            reader = new StandardInput();
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    interface Input extends Closeable {
        String next() throws IOException;

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

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

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

        default int[] readIntArray() throws IOException {
            return readIntArray(nextInt());
        }

        default int[] readIntArray(int size) throws IOException {
            int[] array = new int[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        default long[] readLongArray(int size) throws IOException {
            long[] array = new long[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextLong();
            }
            return array;
        }
    }

    private static class StandardInput implements Input {
        private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        private StringTokenizer stringTokenizer;

        @Override
        public void close() throws IOException {
            reader.close();
        }

        @Override
        public String next() throws IOException {
            if (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
                stringTokenizer = new StringTokenizer(reader.readLine());
            }
            return stringTokenizer.nextToken();
        }
    }
}

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

public class LittleGirlAndMaximumXOR {
    private static boolean debug = false;

    private static long L, R;

    private static void solveProblem(InputStream instr) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(instr)));
        int testCount = 1;
        if (debug) {
            testCount = sc.nextInt();
        }

        for (int t = 1; t <= testCount; t++) {
            printDebug("------ " + t + " ------");
            L = sc.nextLong();
            R = sc.nextLong();
            Object result = solveTestCase();
            System.out.println(result);
        }
    }

    public static String lpad(String str, int num, char ch) {
        return String.format("%1$" + num + "s", str).replace(' ', ch);
    }

    private static Object solveTestCase() {
        int count = 0;
        if (L == R) {
            return 0;
        }
        String left = Long.toBinaryString(L);
        String right = Long.toBinaryString(R);
        long num = (1 << right.length()) - 1;
        return num;
    }

    private static int[] readInts(Scanner sc, int N) {
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        return arr;
    }

    private static String joinValues(List<? extends Object> list, String delim) {
        return list.stream().map(Object::toString).collect(Collectors.joining(delim));
    }

    public static void printDebug(Object str) {
        if (debug) {
            System.out.println("DEBUG: " + str);
        }
    }

    public static void main(String[] args) throws Exception {
        long currTime = System.currentTimeMillis();
        if (debug) {
            solveProblem(new FileInputStream(new File("input.in")));
            System.out.println("Time: " + (System.currentTimeMillis() - currTime));
        } else {
            solveProblem(System.in);
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Round196_D {

    int[] left;
    int[] right;
    int N;

    public void solve() throws Exception {

        InputReader in = new InputReader();
        long l = in.nextLong();
        long r = in.nextLong();

        BigInteger a = new BigInteger(l + "");
        String le = a.toString(2);
        BigInteger b = new BigInteger(r + "");
        String ri = b.toString(2);
        N = ri.length();
        left = new int[N];
        right = new int[N];
        for (int i = 0; i < N; i++)
            right[i] = ri.charAt(i) - '0';
        int start = N - le.length();
        for (int i = start; i < N; i++)
            left[i] = le.charAt(i-start) - '0';
        int diff =0;
        for(int i =0 ; i < N;i++){
            if(left[i] == 0 && right[i] == 1)
                diff = N-i;
        }
        System.out.println((1<<diff)-1);
    }

    public static void main(String[] args) throws Exception {
        new Round196_D().solve();

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer st;

        public InputReader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
            st = new StringTokenizer(in.readLine());

        }

        public String next() throws IOException {

            while (!st.hasMoreElements())
                st = new StringTokenizer(in.readLine());
            return st.nextToken();
        }

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

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

}

import java.util.*;
import java.lang.*;

public class hack
{
    public static void main(String[] args)
    {
    	Scanner sc = new Scanner(System.in);
    	long l = sc.nextLong();
    	long r = sc.nextLong();
    	if(r-l == 0)
    	{
    		System.out.println(0);
    		return;
    	}
    	long digits =(int)( Math.log(r-l)/Math.log(2))+1;
    	//l = (l>>digits);
    	//l = (l<<digits);
    	r = (r>>digits);
    	r = (r<<digits);
    	System.out.println(digits);
    	long ans = r + (int)Math.pow(2,digits)-1;
    	if(r == 0)
    		{
    			System.out.println((long)Math.pow(2,digits)-1);
    		}
    	else
    		{
    			System.out.println((long)Math.pow(2,digits+1) -1);
    		}
    	sc.close();
    }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.ObjectInputStream.GetField;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

	public class Q1 {

		static long MOD = 1000000007;
		static boolean b[], b1[], check;
		static ArrayList<Integer>[] amp, pa;
		static ArrayList<Pair>[] amp1;
		static ArrayList<Pair>[][] damp;
		static int left[],s[],right[],end[],sum[],dist[],cnt[],start[],color[],parent[],prime[],size[];
		static long ans = 0,k;
		static int p = 0;
		static FasterScanner sc = new FasterScanner(System.in);
		static Queue<Integer> queue = new LinkedList<>();
		static PriorityQueue<Integer> pq;
		static BufferedWriter log;
		static HashSet<Integer>[] hs;
		static HashMap<String,Integer> hm;
		static HashMap<Pair,Integer> hmp;
		static Stack<Integer> st;
		static boolean boo[][];
		static Pair prr[];
		static long parent1[],parent2[],size1[],size2[],arr1[],SUM[],MAX[];
		static int arr[];
		public static void main(String[] args) throws Exception {
	    	/*new Thread(null, new Runnable() {
				public void run() {
					try {

				} catch (Exception e) {
						System.out.println(e);
					}
				}
			}, "1", 1 << 26).start();*/
			soln();
		}
		static long dp[][];
		static int N,K,T;
		static int time = 0;
		static int cost[][];
		static boolean b11[];
		static HashMap<Pair,Integer> h = new HashMap<>();
		static long ans1;
		static long ans2;
		static ArrayList<Integer> ampp;
		public static void soln() throws IOException {
			//FasterScanner in = new FasterScanner(new FileInputStream("C:\\Users\\Admin\\Desktop\\QCL.txt"));
			//PrintWriter out = new PrintWriter("C:\\Users\\Admin\\Desktop\\A1.txt");
			log = new BufferedWriter(new OutputStreamWriter(System.out));
			long l = sc.nextLong(), r = sc.nextLong();
			String str = Long.toBinaryString(r);
			String str2 = Long.toBinaryString(l);
			StringBuilder sb = new StringBuilder();
			sb.append(str2);
			while(sb.length()!=str.length()) sb.insert(0, 0);
			str2 = sb.toString();
			sb = new StringBuilder();
			if(l==r){
				System.out.println(0);
				return;
			}
			boolean b = false;
			for(int i = 0; i< str.length();i++){
				//System.out.println(str.charAt(i)+" "+str2.charAt(i));
				if(str.charAt(i)=='1'){
					if(str2.charAt(i)=='1') sb.append('0');
					else{
						b = true;
						sb.append('1');
					}
				}
				else{
					if(str2.charAt(i)=='1') sb.append(1);
					else{
						if(b){
						for(int j = i;j<str.length();j++) sb.append('1');
						break;
						}
						else sb.append('0');
					}
				}
			}
			//System.out.println(sb);
			int cnt = 0;
			long ans = 0;
			for(int j = sb.length()-1;j>=0;j--){
				if(sb.charAt(j)=='1'){
					ans += (long)Math.pow(2, cnt);
				}
				//System.out.println(ans);
				cnt++;
			}
			System.out.println(ans);
			log.close();
			//out.close();
		}
		static boolean check(char c){
			if(c=='a' || c=='e' || c=='i' || c=='y' || c=='u' || c=='o') return true;
			return false;
		}
		static void bfs(int x){

		}
		static void dfs(int x){
			b[x] = true;
			if(amp[x].size()%2==1) p++;
			for(int p:amp[x]){
				if(!b[p]){
					dfs(p);
				}
			}
		}
		static long comp(long n, long m){
			int l = Math.max(Long.toBinaryString(n).length(),Long.toBinaryString(m).length());
			System.out.println((m&(n^MAX[l]))+" "+(((m^MAX[l])&n)));
			return 2*((m&(n^MAX[l]))+(((m^MAX[l])&n)));
		}
		static void recur(int n, int m, int k){
			if(n<0 || m<0) return;
			if(k==0){
				p++;
				return;
			}
			recur(n-k,m,k-1);
			recur(n,m-k,k-1);
			return;
		}
		public static void buildWeightedGraph(int n){
			for(int i =0 ;i< n; i++){
				int x = sc.nextInt(), y = sc.nextInt(), w = sc.nextInt();
				amp1[--x].add(new Pair(--y,w));
				amp1[y].add(new Pair(x,w));
			}
		}

		public static void seive(int n){
			b = new boolean[(n+1)];
			Arrays.fill(b, true);
			b[1] = false;
			for(int i = 2;i*i<=n;i++){
				if(b[i]){
					for(int p = 2*i;p<=n;p+=i){
						b[p] = false;
					}
				}
			}
			/*for(int i = 2;i<=n;i++){
				if(b[i]) prime[i] = i;
			}*/
		}

		static class Graph{
			int vertex;
			int weight;
			Graph(int v, int w){
				vertex = v;
				weight = w;
			}
		}
		static class Pair implements Comparable<Pair> {
			int u;
			int v;
			public Pair(){
				u = 0;
				v = 0;
			}
			public Pair(int u, int v) {
				this.u = u;
				this.v = v;
			}
			public int hashCode() {
				int hu = (int) (u ^ (u >>> 32));
				int hv = (int) (v ^ (v >>> 32));
				return 31*hu + hv;
			}

			public boolean equals(Object o) {
				Pair other = (Pair) o;
				return (u == other.u && v == other.v);
			}

			public int compareTo(Pair other) {
				return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(v, other.v));
			}

			public String toString() {
				return "[u=" + u + ", v=" + v + "]";
			}
		}

		public static void buildGraph(int n){
			for(int i =0;i<n;i++){
				int x = sc.nextInt()-1, y = sc.nextInt()-1;
				amp[x].add(y);
				amp[y].add(x);
			}
		}

		public static int getParent(long x){
			while(parent[(int) x]!=x){
				parent[ (int) x] = parent[(int) parent[ (int) x]];
				x = parent[ (int) x];
			}
			return (int) x;
		}
		static long min(long a, long b, long c){
			if(a<b && a<c) return a;
			if(b<c) return b;
			return c;
		}
		/*

		static class Pair3{
			int x, y ,z;
			Pair3(int x, int y, int z){
				this.x = x;
				this.y = y;
				this.z = z;
			}
		}*/
		static int sum(int n){
			String str = Integer.toString(n);
			int cnt = 0;
			for(int i = 0; i< str.length();i++){
				cnt+=(str.charAt(i)-'0');
			}
			return cnt;
		}
		 static void KMPSearch(String pat, String txt)
		    {
		        int M = pat.length();
		        int N = txt.length();

		        // create lps[] that will hold the longest
		        // prefix suffix values for pattern
		        int lps[] = new int[M];
		        int j = 0;  // index for pat[]

		        // Preprocess the pattern (calculate lps[]
		        // array)
		        computeLPSArray(pat,M,lps);

		        int i = 0;  // index for txt[]
		        while (i < N)
		        {
		            if (pat.charAt(j) == txt.charAt(i))
		            {
		                j++;
		                i++;
		            }
		            if (j == M)
		            {
		               // parent.add((i-j));
		                j = lps[j-1];
		            }

		            // mismatch after j matches
		            else if (i < N && pat.charAt(j) != txt.charAt(i))
		            {
		                // Do not match lps[0..lps[j-1]] characters,
		                // they will match anyway
		                if (j != 0)
		                    j = lps[j-1];
		                else
		                    i = i+1;
		            }
		        }
		    }
		 static void computeLPSArray(String pat, int M, int lps[])
		    {
		        // length of the previous longest prefix suffix
		        int len = 0;
		        int i = 1;
		        lps[0] = 0;  // lps[0] is always 0

		        // the loop calculates lps[i] for i = 1 to M-1
		        while (i < M)
		        {
		            if (pat.charAt(i) == pat.charAt(len))
		            {
		                len++;
		                lps[i] = len;
		                i++;
		            }
		            else  // (pat[i] != pat[len])
		            {
		                // This is tricky. Consider the example.
		                // AAACAAAA and i = 7. The idea is similar
		                // to search step.
		                if (len != 0)
		                {
		                    len = lps[len-1];

		                    // Also, note that we do not increment
		                    // i here
		                }
		                else  // if (len == 0)
		                {
		                    lps[i] = len;
		                    i++;
		                }
		            }
		        }
		    }
		private static void permutation(String prefix, String str) {
		    int n = str.length();
		    if (n == 0); //hs.add(prefix);
		    else {
		        for (int i = 0; i < n; i++)
		            permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n));
		    }
		}
		public static char give(char c1,char c2){
			if(c1!='a' && c2!='a') return 'a';
			if(c1!='b' && c2!='b') return 'b';
			return 'c';
		}

		public static void buildTree(int n){
			int arr[] = sc.nextIntArray(n);
			for(int i = 0;i<n;i++){
				int x = arr[i]-1;
				amp[i+1].add(x);
				amp[x].add(i+1);
			}
		}

		static class SegmentTree {
			boolean st[];
			boolean lazy[];

			SegmentTree(int n) {
				int size = 4 * n;
				st = new boolean[size];
				Arrays.fill(st, true);
				lazy = new boolean[size];
				Arrays.fill(lazy, true);
				//build(0, n - 1, 1);
			}

			/*long[] build(int ss, int se, int si) {
				if (ss == se) {
					st[si][0] = 1;
					st[si][1] = 1;
					st[si][2] = 1;
					return st[si];
				}
				int mid = (ss + se) / 2;
				long a1[] = build(ss, mid, si * 2), a2[] = build(mid + 1, se,
						si * 2 + 1);
				long ans[] = new long[3];
				if (arr[mid] < arr[mid + 1]) {
					ans[1] = Math.max(a2[1], Math.max(a1[1], a1[2] + a2[0]));
					if (a1[1] == (mid - ss + 1))
						ans[0] = ans[1];
					else
						ans[0] = a1[0];
					if (a2[2] == (se - mid))
						ans[2] = ans[1];
					else
						ans[2] = a2[2];
				} else {
					ans[1] = Math.max(a1[1], a2[1]);
					ans[0] = a1[0];
					ans[2] = a2[2];
				}
				st[si] = ans;
				return st[si];
			}*/

			void update(int si, int ss, int se, int idx, long x) {
				if (ss == se) {
					//arr[idx] += val;
					st[si]=false;
				}
				else {
					int mid = (ss + se) / 2;
					if(ss <= idx && idx <= mid)
			        {
			             update(2*si, ss, mid, idx, x);
			        }
			        else
			        { update(2*si+1, mid+1, se, idx, x);
			        }
					st[si] = st[2*si]|st[2*si+1];
				}
			}
			/*boolean get(int qs, int qe, int ss, int se, int si){
				if(qs>se || qe<ss) return 0;
				if (qs <= ss && qe >= se) {
					return st[si];
				}
				int mid = (ss+se)/2;
				return get(qs, qe, ss, mid, si * 2)+get(qs, qe, mid + 1, se, si * 2 + 1);
			}*/
			void updateRange(int node, int start, int end, int l, int r, boolean val)
			{
			    if(!lazy[node])
			    {
			        // This node needs to be updated
			        st[node] = lazy[node];    // Update it
			        if(start != end)
			        {
			            lazy[node*2] = lazy[node];                  // Mark child as lazy
			            lazy[node*2+1] = lazy[node];                // Mark child as lazy
			        }
			        lazy[node] = true;                                  // Reset it
			    }
			    if(start > end || start > r || end < l)              // Current segment is not within range [l, r]
			        return;
			    if(start >= l && end <= r)
			    {
			        // Segment is fully within range
			        st[node] =  val;
			        if(start != end)
			        {
			            // Not leaf node
			            lazy[node*2] = val;
			            lazy[node*2+1] = val;
			        }
			        return;
			    }
			    int mid = (start + end) / 2;
			    updateRange(node*2, start, mid, l, r, val);        // Updating left child
			    updateRange(node*2 + 1, mid + 1, end, l, r, val);   // Updating right child
			    st[node] = st[node*2] | st[node*2+1];        // Updating root with max value
			}

			boolean queryRange(int node, int start, int end, int l, int r)
			{
			    if(start > end || start > r || end < l)
			        return false;         // Out of range
			    if(!lazy[node])
			    {
			        // This node needs to be updated
			        st[node] = lazy[node];            // Update it
			        if(start != end)
			        {
			            lazy[node*2] = lazy[node];         // Mark child as lazy
			            lazy[node*2+1] = lazy[node];    // Mark child as lazy
			        }
			        lazy[node] = true;                 // Reset it
			    }
			    if(start >= l && end <= r)             // Current segment is totally within range [l, r]
			        return  st[node];
			    int mid = (start + end) / 2;
			    boolean p1 = queryRange(node*2, start, mid, l, r);         // Query left child
			    boolean b = queryRange(node*2 + 1, mid + 1, end, l, r); // Query right child
			    return (p1 | b);
			}
			void print() {
				for (int i = 0; i < st.length; i++) {
					System.out.print(st[i]+" ");
				}
				System.out.println();
			}
		}
		static int convert(int x){
			int cnt = 0;
			String str = Integer.toBinaryString(x);
			//System.out.println(str);
			for(int i = 0;i<str.length();i++){
				if(str.charAt(i)=='1'){
					cnt++;
				}
			}
			int ans = (int) Math.pow(3, 6-cnt);
			return ans;
		}
		static class Node2{
			Node2 left = null;
			Node2 right = null;
			Node2 parent = null;
			int data;
		}
		static class BinarySearchTree{
			Node2 root = null;
			int height = 0;
			int max = 0;
			int cnt = 1;
			ArrayList<Integer> parent = new ArrayList<>();
			HashMap<Integer, Integer> hm = new HashMap<>();
			public void insert(int x){
				Node2 n = new Node2();
				n.data = x;
				if(root==null){
					root = n;
				}
				else{
					Node2 temp = root,temb = null;
					while(temp!=null){
						temb = temp;
						if(x>temp.data) temp = temp.right;
						else temp = temp.left;
					}
					if(x>temb.data) temb.right = n;
					else temb.left = n;
					n.parent = temb;
					parent.add(temb.data);
				}
			}
			public Node2 getSomething(int x, int y, Node2 n){
				if(n.data==x || n.data==y) return n;
				else if(n.data>x && n.data<y) return n;
				else if(n.data<x && n.data<y) return getSomething(x,y,n.right);
				else return getSomething(x,y,n.left);
			}
			public Node2 search(int x,Node2 n){
				if(x==n.data){
					max = Math.max(max, n.data);
					return n;
				}
				if(x>n.data){
					max = Math.max(max, n.data);
					return search(x,n.right);
				}
				else{
					max = Math.max(max, n.data);
					return search(x,n.left);
				}
			}
			public int getHeight(Node2 n){
				if(n==null) return 0;
				height = 1+ Math.max(getHeight(n.left), getHeight(n.right));
				return height;
			}
		}
		static long findDiff(long[] arr, long[] brr, int m){
			int i = 0, j = 0;
			long fa = 1000000000000L;
			while(i<m && j<m){
				long x = arr[i]-brr[j];
				if(x>=0){
					if(x<fa) fa = x;
					j++;
				}
				else{
					if((-x)<fa) fa = -x;
					i++;
				}
			}
			return fa;
		}
		public static long max(long x, long y, long z){
			if(x>=y && x>=z) return x;
			if(y>=x && y>=z) return y;
			return z;
		}

		static long modInverse(long a, long mOD2){
		            return  power(a, mOD2-2, mOD2);
		}
		static long power(long x, long y, long m)
		{
		    if (y == 0)
		        return 1;
		    long p = power(x, y/2, m) % m;
		    p = (p * p) % m;

		    return (y%2 == 0)? p : (x * p) % m;
		}
		static long power2(long x,BigInteger y,long m){
			long ans = 1;
			BigInteger two = new BigInteger("2");
			while(y.compareTo(BigInteger.ZERO)>0){
				if(y.getLowestSetBit()==y.bitCount()){
					x = (x*x)%MOD;
					y = y.divide(two);
				}
				else{
					ans = (ans*x)%MOD;
					y = y.subtract(BigInteger.ONE);
				}
			}
			return ans;
		}
		static BigInteger power2(BigInteger x, BigInteger y, BigInteger m){
			BigInteger ans = new BigInteger("1");
			BigInteger one  = new BigInteger("1");
			BigInteger two  = new BigInteger("2");
			BigInteger zero  = new BigInteger("0");
			while(y.compareTo(zero)>0){
				//System.out.println(y);
				if(y.mod(two).equals(one)){
					ans = ans.multiply(x).mod(m);
					y = y.subtract(one);
				}
				else{
					x = x.multiply(x).mod(m);
					y = y.divide(two);
				}
			}
			return ans;
		}
		static BigInteger power(BigInteger x, BigInteger y, BigInteger m)
		{
		    if (y.equals(0))
		        return (new BigInteger("1"));
		    BigInteger p = power(x, y.divide(new BigInteger("2")), m).mod(m);
		    p = (p.multiply(p)).mod(m);

		    return (y.mod(new BigInteger("2")).equals(0))? p : (p.multiply(x)).mod(m);
		}
		static long d,x,y;
		public static void extendedEuclidian(long a, long b){
			if(b == 0) {
		        d = a;
		        x = 1;
		        y = 0;
		    }
		    else {
		        extendedEuclidian(b, a%b);
		        int temp = (int) x;
		        x = y;
		        y = temp - (a/b)*y;
		    }
		}

		public static long gcd(long n, long m){
			if(m!=0) return gcd(m,n%m);
			else return n;
		}

		static BufferedReader reader;
	    static StringTokenizer tokenizer;
	    static PrintWriter writer;

	    static class FasterScanner {

			private final InputStream stream;
			private final byte[] buf = new byte[8192];
			private int curChar, snumChars;
			private SpaceCharFilter filter;

			public FasterScanner(InputStream stream) {
				this.stream = stream;
			}

			public int snext() {
				if (snumChars == -1)
					throw new InputMismatchException();
				if (curChar >= snumChars) {
					curChar = 0;
					try {
						snumChars = stream.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (snumChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}

			public int nextInt() {
				int c = snext();
				while (isSpaceChar(c)) {
					c = snext();
				}
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = snext();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = snext();
				} while (!isSpaceChar(c));
				return res * sgn;
			}

			public long nextLong() {
				int c = snext();
				while (isSpaceChar(c)) {
					c = snext();
				}
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = snext();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = snext();
				} while (!isSpaceChar(c));
				return res * sgn;
			}

			public int[] nextIntArray(int n) {
				int a[] = new int[n];
				for (int i = 0; i < n; i++) {
					a[i] = nextInt();
				}
				return a;
			}

			public long[] nextLongArray(int n) {
				long a[] = new long[n];
				for (int i = 0; i < n; i++) {
					a[i] = nextInt();
				}
				return a;
			}

			public String readString() {
				int c = snext();
				while (isSpaceChar(c)) {
					c = snext();
				}
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = snext();
				} while (!isSpaceChar(c));
				return res.toString();
			}

			public String nextLine() {
				int c = snext();
				while (isSpaceChar(c))
					c = snext();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = snext();
				} while (!isEndOfLine(c));
				return res.toString();
			}

			public boolean isSpaceChar(int c) {
				if (filter != null)
					return filter.isSpaceChar(c);
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}

			private boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			}

			public interface SpaceCharFilter {
				public boolean isSpaceChar(int ch);
			}
		}
	}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

import javax.swing.event.CellEditorListener;

public class moor {

	static class pair implements Comparable<pair> {
		String x;
		int y;

		pair(String i, int j) {
			x = i;
			y = j;
		}

		@Override
		public int compareTo(pair o) {
			return (this.y - o.y);
		}
	}

	/*
	 * 1. Sieve of Eratosthenes: generate all primes in [2, N]
	 */
	static ArrayList<Integer> primes;
	static int[] isComposite;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		char min[] = Long.toBinaryString(Long.parseLong(st.nextToken())).toCharArray();
		char max[] = Long.toBinaryString(Long.parseLong(st.nextToken())).toCharArray();
		long ans = 0;
		if (max.length > min.length) {
			pw.print(Math.pow(2,max.length)-1);

		} else {
			int i = 0;
			for (i = 0; i < max.length; i++) {
				if (max[i] != min[i])
					break;
			}
			for (int j = 0; j < min.length - i; j++) {
				ans += Math.pow(2, j);
			}
			pw.print(ans);
		}
		pw.flush();

	}

}

import java.util.*;
import java.math.*;
import java.io.*;
 import java.text.DecimalFormat;
public class Main{
    static int[] arr;
    static String h;
    public static void main(String[] args)  throws IOException {
        s.init(System.in);
        PrintWriter out = new PrintWriter(System.out);

        long a,b;
        String x,y,z1,z2;
        a=s.nextLong();
        b=s.nextLong();
        y=Long.toBinaryString(b);
        x=Long.toBinaryString(a);

        while(x.length()<y.length())
            x="0"+x;
        int flag1,flag2;
        flag1=flag2=0;
        long v1,v2;
        v1=v2=0;
        z1=z2="";
        long p=(long)Math.pow(2,x.length()-1);
        for(int i=0;i<y.length();i++){
            char c,d;
            c=x.charAt(i);
            d=y.charAt(i);
            if(c!=d){
                z1=z1+""+c;
                z2=z2+""+d;
                if(c=='0')
                    v2+=p;
                else
                    v1+=p;
            }

            else if(c=='0'&&d=='0'){
                if(((v2+p)<=b)){
                    z1=z1+""+'0';
                    z2=z2+""+'1';
                    v2+=p;
                }
                else if(((v1+p)<=b)){
                    z1=z1+""+'1';
                    z2=z2+""+'0';
                    v1+=p;
                }

                else{
                    z1=z1+"0";
                    z2=z2+"0";
                }

            }
            else{
                if(((v1+p-1)>=a)){
                    z1=z1+""+'0';
                    z2=z2+""+'1';
                    v2+=p;
                }
                else if(((v2+p-1)>=a)){
                    z1=z1+""+'1';
                    z2=z2+""+'0';
                    v1+=p;
                }
                else{
                    z1=z1+"1";
                    z2=z2+"1";
                }

            }
            p/=2;
        }

        System.out.println(Long.parseLong(z1,2)^Long.parseLong(z2,2));
    }
    static class paint implements Comparable<paint>{
        int clr;
        HashSet<Integer> hs;
        public paint(int x){
            clr=x;
            hs=new HashSet<Integer>();
        }
        public  int compareTo(paint o){
            if(o.hs.size()!=hs.size())
                return o.hs.size()-hs.size();
            else
                return clr-o.clr;
            }
    }
    public static int pow(int x,int y){
        int ans=1;
        while(y>0){
            if(y%2==1)
                ans*=x;
            x*=x;

            y/=2;

        }
        return ans;
    }
    public static class s {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /** call this method to initialize reader for InputStream */
        static void init(InputStream input) {
            reader = new BufferedReader(
                        new InputStreamReader(input) );
            tokenizer = new StringTokenizer("");
        }

        /** get next word */
        static String next() throws IOException {
            while ( ! tokenizer.hasMoreTokens() ) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                    reader.readLine() );
            }
            return tokenizer.nextToken();
        }

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

        static double nextDouble() throws IOException {
            return Double.parseDouble( next() );
        }
        static long nextLong() throws IOException {
            return Long.parseLong( next() );
        }

    }
}

import java.util.*;
import java.io.*;
//import java.lang.*;

public class ranjan{

    public static Read cin;
    //public static InputReader cin;
    public static PrintWriter cout;
    public static boolean[] visited;
    public static final long b = (long)1e9+7;
    public static int fileread = 0;

    public static void main(String ...arg) throws IOException
    {
        /*console writer*/
        cout = new PrintWriter(new BufferedOutputStream(System.out));
        /*Debug Reader*/
        //Scan cin =new Scan();
        if(fileread == 1)
        {
            try
            {
            cin = new Read(new FileInputStream(new File("in1.txt")));
            //cin = new InputReader(new FileInputStream(new File("in1.txt")));
            }
            catch (IOException error){}
        }
        else{
            cin = new Read(System.in);
            //cin = new InputReader(System.in);
        }

        long l = cin.nextLong();
    	long r = cin.nextLong();
    	if(r-l <= 0)
    	{
    		cout.print(r^l);
    		return;
        }
    	int digits =(int)( Math.log(r-l)/Math.log(2))+1;
    	l = (l>>digits);
    	l = (l<<digits);
    	r = (r>>digits);
    	r = (r<<digits);
        l += Math.pow(2,digits)-1;
        cout.print(l^r);

        cout.close();
    }

    public static long mod_pow(long x,long n,long mod) {
		long res=1;
		while(n>0) {
			if((n&1)==1)res=res*x%mod;
			x=x*x%mod;
			n>>=1;
		}
		return res;
    }
    public static long gcd(long n1, long n2)
	{
		long r;
		while (n2 != 0)
		{
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2)
	{
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

    static class InputReader {
        final InputStream is;
        final byte[] buf = new byte[1024];
        int pos;
        int size;

        public InputReader(InputStream is) {
            this.is = is;
        }

        public int nextInt() {
            int c = read();
            while (isWhitespace(c))
                c = read();
            int sign = 1;
            if (c == '-') {
                sign = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res = res * 10 + c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sign;
        }

        int read() {
            if (size == -1)
                throw new InputMismatchException();
            if (pos >= size) {
                pos = 0;
                try {
                    size = is.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (size <= 0)
                    return -1;
            }
            return buf[pos++] & 255;
        }

        static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

static class RecursionLimiter {
    public static long maxLevel = 1549;

    public static void emerge() {
        if (maxLevel == 0)
            return;
        try {
            throw new IllegalStateException("Too deep, emerging");
        } catch (IllegalStateException e) {
            if (e.getStackTrace().length > maxLevel + 1)
                throw e;
        }
    }
}

static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }

}

class Read
{
    private BufferedReader br;
    private StringTokenizer st;

    public Read(InputStream is)
    { br = new BufferedReader(new InputStreamReader(is)); }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try {st = new StringTokenizer(br.readLine());}
            catch(IOException e)
                {e.printStackTrace();}
        }
        return st.nextToken();
    }

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

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

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

    String nextLine()
    {
        String str = "";
        try {str = br.readLine();}
        catch(IOException e)
            {e.printStackTrace();}
        return str;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {
	static BufferedReader in;
	static StringTokenizer st;
	static PrintWriter out;
	public static void main(String[] args) throws IOException {
		begin();
		solve();
		end();
	}
	private static void end() {
		out.close();
	}
	private static void solve() throws IOException {
		long l = nextLong();
		long r = nextLong();
		int p = 63;
		while (p >= 0 && hing(l,p) == hing(r,p)){
			p--;
		}
		write((1<<(p+1))-1);

	}
	private static boolean hing(long x, int bit) {
		return (x&(1<<bit)) != 0;
	}
	private static long nextLong() throws  IOException {
		return Long.parseLong(next());
	}
	private static void writeln(Object t) {
		out.println(t);
	}
	private static void write(Object t) {
		out.print(t);
	}
	private static int nextInt() throws  IOException {
		return Integer.parseInt(next());
	}
	private static String next() throws IOException {
		while (!st.hasMoreElements())
			st = new StringTokenizer(in.readLine());

		return st.nextToken();
	}
	private static void begin() {
		out = new PrintWriter(new OutputStreamWriter(System.out));
		st = new StringTokenizer("");
		in = new BufferedReader(new InputStreamReader(System.in));
	}

}

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

public class Main{
   	static void main() throws Exception{
   		long l=sc.nextLong(),r=sc.nextLong();
   		if(l==r) {
   			pw.println(0);
   			return;
   		}
   		long dif=r-l;
   		long ans=0;
   		for(int bit=62;bit>=0;bit--) {
   			if(dif>=(1l<<bit)) {
   				ans|=(1l<<bit);
   			}
   		}
   		pw.println(ans);
	}
	public static void main(String[] args) throws Exception{
		pw=new PrintWriter(System.out);
		sc = new MScanner(System.in);
		int tc=1;
		while(tc-->0)main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

/*  convert each # to binary, subtract the two
if number is <= 11, print number
else, is the difference as all 1s, convert back to base 10
*/

import java.util.*;

public class LittleGirlMaxXOR
{
	public static final double START_BASE = 10;
	public static final double FINAL_BASE = 2;
	public static final int CUTOFF = 11;

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int l = in.nextInt();
		int r = in.nextInt();
		// check for exceptions in lines above

		//long l2Bin = convert2Bin(l, 0);
		//long r2Bin = convert2Bin(r, 0);

		long diff = convert2Bin(l ^ r,0);

		if (diff <= CUTOFF)
		{
			long ans = Long.parseLong(Long.toString(diff),(int) FINAL_BASE);
			System.out.println(ans);
		}
		else
		{
			System.out.println(diff);
			/*convert to string, then change every digit to 1, convert to decimal*/
			long ans = 0;
			for (double i = 0; i < String.valueOf(Long.toString(diff)).length(); i++)
			{
				ans += (long) Math.pow(START_BASE,i);
			}
			System.out.println(ans);
			ans = Long.parseLong(Long.toString(ans),(int) FINAL_BASE);
			System.out.println(ans);
		}
	}

	public static int convert2Bin(int rem, int bin)
	{
		double exp = 0;
		if (rem > 1)
		{
			int temp = rem;
			while (temp > FINAL_BASE-1)
			{
				temp = temp/(int) FINAL_BASE;
				exp++;
			}
			bin = bin + (int) Math.pow(START_BASE,exp);
			rem = rem % (int) (Math.pow(FINAL_BASE,exp));
			return convert2Bin(rem,bin);
		}
		else
		{
			return bin + rem;
		}

	}

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class cfvc15
{
	static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input)
    {
        reader = new BufferedReader( new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    static String next() throws IOException
    {
        while ( ! tokenizer.hasMoreTokens() )
        {
            tokenizer = new StringTokenizer(reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static long nextInt() throws IOException
    {
        return Long.parseLong( next() );
    }
	static PrintWriter writer;
	static void outit(OutputStream outputStream)
	{
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	static void print(Object...objects) {
		for (int i = 0; i < objects.length; i++)
		{
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	static void println(Object...objects) {
		print(objects);
		writer.println();
	}

	static void close() {
		writer.close();
	}

	static void flush() {
		writer.flush();
	}
	public static void print_a(long [] a)
    {
    	for(long i : a)
    	{
    		print(i+" ") ;
    	}
    	println() ;
    }
    public static void main(String [] args) throws IOException
    {
    	init(System.in) ;
    	outit(System.out) ;
//    	int t = (int) nextInt() ;
//    	for(int i =0 ; i<t ; i++)
    	output() ;
        flush();
        close();
    }
    static long mod = 1000000007 ;
    static ArrayList<ArrayList<Integer>> ar ;
    static int [] c ;
    public static void output() throws IOException
    {
    	long l = nextInt() ;
    	long r = nextInt() ;
    	String ls = Long.toBinaryString(l) ;
    	String rs = Long.toBinaryString(r) ;
    	int diff = rs.length()-ls.length() ;
    	for(int i = 0 ; i<diff ; i++)
    	{
    		ls = "0"+ls ;
    	}
//    	println(ls) ;
//    	println(rs) ;
    	int c = -1 ;
    	for(int i = 0 ; i<rs.length(); i++)
    	{
    		if(ls.charAt(i)!=rs.charAt(i))
    		{
    			c = i ;
//    			println(c) ;
    		}
    	}
    	if(c==-1)
    	{
    		println(0) ;
    	}
    	else
    	{
    		long ans = (long) (Math.pow(2,rs.length()-c)*2-1) ;
    		println(ans) ;
    	}
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main
{
	public static void main(String[] args)
    throws IOException
	{
        BufferedReader reader = new BufferedReader(
            new InputStreamReader(System.in));

        String []arr = reader.readLine().split(" ");
        long x,y;
        x = Long.parseLong(arr[0]);
        y = Long.parseLong(arr[1]);

        if((x ^ y) == 0)
            System.out.println(0);
        else
        {
            int len = Long.toBinaryString(y).length();

            long res = 1L << (len - 1);
            System.out.println(res ^ (res - 1));

        }

    }
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
import java.text.DecimalFormat;
import java.lang.reflect.Array;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
public class Codeforces{
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long MOD = (long)(1e9+7);
	static long MOD2 = MOD*MOD;
	//static long MOD = 998244353;
	static FastReader sc = new FastReader();
	static int pInf = Integer.MAX_VALUE;
	static int nInf = Integer.MIN_VALUE;
	public static void main(String[] args){
		int test = 1;
		//test = sc.nextInt();
		while(test-->0){
			long a = sc.nextLong();
			long b = sc.nextLong();
			long d = b-a+1;
			int i = 0;
			long ans = 0;
			long t = 1;
			while(t<d) {
				i++;
				ans += t;
				t = t*2;
			}
			if(((b>>i)^(a>>i))==1) {
				ans += t;
			}
			out.println(ans);
		}
		out.close();
	}
	public static long solve(long a, long b, long x, long y, long n) {
		if(a-x<n) {
			n = n-(a-x);
			a = x;
			b = Math.max(y, b-n);
		}
		else {
			a = a-n;
		}
		return a*b;
	}
	public static int lowerBound(int key, ArrayList<Integer> A) {
		int s = 0;
		int e = A.size()-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(A.get(m)>=key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static int upperBound(int key, ArrayList<Integer> A) {
		int s = 0;
		int e = A.size()-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(A.get(m)>key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static long c2(long n) {
		if((n&1)==0) {
			return mul(n/2, n-1);
		}
		else {
			return mul(n, (n-1)/2);
		}
	}
	public static long mul(long a, long b){
	    return ((a%MOD)*(b%MOD))%MOD;
	}
	public static long add(long a, long b){
	    return ((a%MOD)+(b%MOD))%MOD;
	}
	public static long sub(long a, long b){
	    return ((a%MOD)-(b%MOD))%MOD;
	}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Integer.lowestOneBit(i)   Equals k where k is the position of the first one in the binary
//Integer.highestOneBit(i)  Equals k where k is the position of the last one in the binary
//Integer.bitCount(i)       returns the number of one-bits
//Collections.sort(A,(p1,p2)->(int)(p2.x-p1.x)) To sort ArrayList in descending order wrt values of x.
//            Arrays.parallelSort(a,new Comparator<TPair>() {
//      		public int compare(TPair a,TPair b) {
//        			if(a.y==b.y) return a.x-b.x;
//        			return b.y-a.y;
//        		}
//        	});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//PrimeFactors
    public static ArrayList<Long> primeFactors(long n) {
        ArrayList<Long> arr = new ArrayList<>();
        if (n % 2 == 0)
            arr.add((long) 2);
        while (n % 2 == 0)
            n /= 2;
        for (long i = 3; i <= Math.sqrt(n); i += 2) {
            int flag = 0;
            while (n % i == 0) {
                n /= i;
                flag = 1;
            }
            if (flag == 1)
                arr.add(i);
        }
        if (n > 2)
            arr.add(n);
        return arr;
    }
//Pair Class
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		int len;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
			this.len = y-x+1;
		}
		/*@Override
		public int compareTo(Pair o) {
			if(this.x==o.x){
			    return (this.y-o.y);
			}
			return (this.x-o.x);
		}*/
		@Override
		public int compareTo(Pair o) {
			if(this.len==o.len) {
				return this.x-o.x;
			}
			else {
				return o.len-this.len;
			}
		}
	}
	static class TPair implements Comparable<TPair>{
		int two;
		int three;
		int prime;
		public TPair(int two, int three, int prime) {
			this.two = two;
			this.three = three;
			this.prime = prime;
		}
		@Override
		public int compareTo(TPair o) {
			if(this.three==o.three){
			    return (this.two-o.two);
			}
			return -1*(this.three-o.three);
		}
	}
//nCr
	static long ncr(long n, long k) {
        long ret = 1;
        for (long x = n; x > n - k; x--) {
            ret *= x;
            ret /= (n - x + 1);
        }

        return ret;
    }
	static long finextDoubleMMI_fermat(long n,int M)
    {
        return fastExpo(n,M-2);
    }

    static long nCrModPFermat(int n, int r, int p)
    {
        if (r == 0)
            return 1;
        long[] fac = new long[n+1];
        fac[0] = 1;
        for (int i = 1 ;i <= n; i++)
            fac[i] = fac[i-1] * i % p;
        return (fac[n]* finextDoubleMMI_fermat(fac[r], p)% p * finextDoubleMMI_fermat(fac[n-r], p) % p) % p;
    }
//Kadane's Algorithm
    static long maxSubArraySum(ArrayList<Long> a) {
    	if(a.size()==0) {
    		return 0;
    	}
    	long max_so_far = a.get(0);
    	long curr_max = a.get(0);
    	for (int i = 1; i < a.size(); i++) {
           curr_max = Math.max(a.get(i), curr_max+a.get(i));
           max_so_far = Math.max(max_so_far, curr_max);
    	}
    	return max_so_far;
    }
//Shuffle Sort
    static final Random random=new Random();
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
//Merge Sort
	static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
//Brian Kernighans Algorithm
    static long countSetBits(long n){
        if(n==0) return 0;
        return 1+countSetBits(n&(n-1));
    }
//Factorial
    static long factorial(long n){
        if(n==1) return 1;
        if(n==2) return 2;
        if(n==3) return 6;
        return n*factorial(n-1);
    }
//Euclidean Algorithm
    static long gcd(long A,long B){
        if(B==0) return A;
        return gcd(B,A%B);
    }
//Modular Exponentiation
    static long fastExpo(long x,long n){
        if(n==0) return 1;
        if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
        return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
    }
//AKS Algorithm
    static boolean isPrime(long n){
        if(n<=1) return false;
        if(n<=3) return true;
        if(n%2==0 || n%3==0) return false;
        for(int i=5;i<=Math.sqrt(n);i+=6)
            if(n%i==0 || n%(i+2)==0) return false;
        return true;
    }
//Reverse an array
    static <T> void reverse(T arr[],int l,int r){
    	Collections.reverse(Arrays.asList(arr).subList(l, r));
    }
  //Print array
    static void print1d(int arr[]) {
    	out.println(Arrays.toString(arr));
    }
    static void print2d(int arr[][]) {
    	for(int a[]: arr) out.println(Arrays.toString(a));
    }
//Sieve of eratosthenes
    static int[] findPrimes(int n){
        boolean isPrime[]=new boolean[n+1];
        ArrayList<Integer> a=new ArrayList<>();
        int result[];
        Arrays.fill(isPrime,true);
        isPrime[0]=false;
        isPrime[1]=false;
        for(int i=2;i*i<=n;++i){
            if(isPrime[i]==true){
                for(int j=i*i;j<=n;j+=i) isPrime[j]=false;
            }
        }
        for(int i=0;i<=n;i++) if(isPrime[i]==true) a.add(i);
        result=new int[a.size()];
        for(int i=0;i<a.size();i++) result[i]=a.get(i);
        return result;

    }
//Indivisual factors of all nos till n
    static ArrayList<Integer>[] indiFactors(int n){
    	ArrayList<Integer>[] A = new ArrayList[n+1];
    	for(int i = 0; i <= n; i++) {
    		A[i] = new ArrayList<>();
    	}
    	int[] sieve = new int[n+1];
    	for(int i=2;i<=n;i++) {
       		if(sieve[i]==0) {
       			for(int j=i;j<=n;j+=i) if(sieve[j]==0) {
       				//sieve[j]=i;
       				A[j].add(i);
       			}
       		}
       	}
    	return A;
    }
//Segmented Sieve
    static boolean[] segmentedSieve(long l, long r){
    	boolean[] segSieve = new boolean[(int)(r-l+1)];
    	Arrays.fill(segSieve, true);
    	int[] prePrimes = findPrimes((int)Math.sqrt(r));
    	for(int p:prePrimes) {
    		long low = (l/p)*p;
    		if(low < l) {
    			low += p;
    		}
    		if(low == p) {
    			low += p;
    		}
    		for(long j = low; j<= r; j += p) {
    			segSieve[(int) (j-l)] = false;
    		}
    	}
    	if(l==1) {
    		segSieve[0] = false;
    	}
    	return segSieve;
    }
//Euler Totent function
    static long countCoprimes(long n){
        ArrayList<Long> prime_factors=new ArrayList<>();
        long x=n,flag=0;
        while(x%2==0){
            if(flag==0) prime_factors.add(2L);
            flag=1;
            x/=2;
        }
        for(long i=3;i*i<=x;i+=2){
            flag=0;
            while(x%i==0){
                if(flag==0) prime_factors.add(i);
                flag=1;
                x/=i;
            }
        }
        if(x>2) prime_factors.add(x);
        double ans=(double)n;
        for(Long p:prime_factors){
            ans*=(1.0-(Double)1.0/p);
        }
        return (long)ans;
    }
	static long modulo = (long)1e9+7;
	public static long modinv(long x){
	    return modpow(x, modulo-2);
	}
	public static long modpow(long a, long b){
	    if(b==0){
	        return 1;
	    }
	    long x = modpow(a, b/2);
	    x = (x*x)%modulo;
	    if(b%2==1){
	        return (x*a)%modulo;
	    }
	    return x;
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Washoum
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        inputClass in = new inputClass(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DLittleGirlAndMaximumXOR solver = new DLittleGirlAndMaximumXOR();
        solver.solve(1, in, out);
        out.close();
    }

    static class DLittleGirlAndMaximumXOR {
        public void solve(int testNumber, inputClass sc, PrintWriter out) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            if (a == b) {
                out.println(0);
                return;
            }
            int puisa = (int) (Math.floor(Math.log(a) / Math.log(2)));
            int puisb = (int) (Math.floor(Math.log(b) / Math.log(2)));
            if (puisa < puisb) {
                out.println((1L << (puisb + 1)) - 1);
                return;
            }
            String s = Long.toBinaryString(a);
            String t = Long.toBinaryString(b);
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) != t.charAt(i)) {
                    out.println((1 << (s.length() - i)) - 1);
                    break;
                }
            }

        }

    }

    static class inputClass {
        BufferedReader br;
        StringTokenizer st;

        public inputClass(InputStream in) {

            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

    }
}

import java.util.Scanner;

public class LittleGirlMaxXOR {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();
		if(l == r){
			System.out.println(0);
			return;
		}
		String a = Long.toBinaryString(l);
		String b = Long.toBinaryString(r);
		while(a.length() < 64){
			a = "0"+a;
		}
		while(b.length() < 64){
			b = "0"+b;
		}
		int idx = 0;
		for(int i = 0; i < 64; i++){
			if(a.charAt(i) != b.charAt(i)){
				idx = 64-i;
				break;
			}
		}
		long ans = (long) (Math.pow(2, idx)-1);
		System.out.println(ans);
	}
}

/*  convert each # to binary, subtract the two
if number is <= 11, print number
else, is the difference as all 1s, convert back to base 10
*/

import java.util.*;

public class LittleGirlMaxXOR
{
	public static final double START_BASE = 10;
	public static final double FINAL_BASE = 2;
	public static final int CUTOFF = 11;

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		long l = in.nextLong();
		long r = in.nextLong();
		// check for exceptions in lines above

		//long l2Bin = convert2Bin(l, 0);
		//long r2Bin = convert2Bin(r, 0);

		long diff = convert2Bin(l ^ r,0);

		if (diff <= CUTOFF)
		{
			long ans = Long.parseLong(Long.toString(diff),(int) FINAL_BASE);
			System.out.println(ans);
		}
		else
		{
			/*convert to string, then change every digit to 1, convert to decimal*/
			long ans = 0;
			for (double i = 0; i < String.valueOf(Long.toString(diff)).length(); i++)
			{
				ans += (long) Math.pow(START_BASE,i);
			}
			ans = Long.parseLong(Long.toString(ans),(int) FINAL_BASE);
			System.out.println(ans);
		}
	}

	public static long convert2Bin(long rem, long bin)
	{
		double exp = 0;
		if (rem > 1)
		{
			long temp = rem;
			while (temp > FINAL_BASE-1)
			{
				temp = temp/(int) FINAL_BASE;
				exp++;
			}
			bin = bin + (int) Math.pow(START_BASE,exp);
			rem = rem % (int) (Math.pow(FINAL_BASE,exp));
			return convert2Bin(rem,bin);
		}
		else
		{
			return bin + rem;
		}

	}

}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.round;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
import static java.util.Collections.reverseOrder;
import static java.util.Collections.sort;
import static java.util.Comparator.comparing;

public class Main {
    FastScanner in;
    PrintWriter out;

    private void solve() throws IOException {
        long l = in.nextLong(), r = in.nextLong();
        for (int i = 60; i >= 0; i--)
            if ((l ^ r >> i & 1) == 1) {
                out.println((1L << (i + 1)) - 1);
                return;
            }
        out.println(0);
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

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

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

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

        String nextLine() throws IOException {
            return br.readLine();
        }

        boolean hasNextLine() throws IOException {
            return br.ready();
        }
    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream("input.txt"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream("output.txt"));

        solve();

        out.flush();
        out.close();
    }

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

import java.util.*;
import java.math.*;
import java.io.*;
 import java.text.DecimalFormat;
public class Main{
    static int[] arr;
    static String h;
    public static void main(String[] args)  throws IOException {
        s.init(System.in);
        PrintWriter out = new PrintWriter(System.out);

		long a,b;
		String x,y,z1,z2;
		a=s.nextLong();
		b=s.nextLong();
		y=Long.toBinaryString(b);
		x=Long.toBinaryString(a);

		while(x.length()<y.length())
			x="0"+x;
		int flag1,flag2;
		flag1=flag2=0;
		long v1,v2;
		v1=v2=0;
		z1=z2="";
		long p=(long)Math.pow(2,x.length()-1);
		for(int i=0;i<y.length();i++){
			char c,d;
			c=x.charAt(i);
			d=y.charAt(i);
			if(c!=d){
				if(c==0){
					if(v1+p-1>=a){
						z1=z1+"0";
						if(v2+p<=b){
							z2=z2+"1";
							v2+=p;
						}
						else{
							z2=z2+"0";
						}

					}

					else{
						z1=z1+"1";
						v1+=p;
						if(v2+p-1>=a){
							z2=z2+"0";

						}
						else{
							z2=z2+"1";
							v2+=p;
						}

					}

				}
				else if(v2+p-1>=a){
						z2=z2+"0";
						if(v1+p<=b){
							z1=z1+"1";
							v1+=p;
						}
						else{
							z1=z1+"0";
						}

					}

					else{
						z2=z2+"1";
						v2+=p;
						if(v1+p-1>=a){
							z1=z1+"0";

						}
						else{
							z1=z1+"1";
							v1+=p;
						}

					}

				}

			else if(c=='0'&&d=='0'){
				if(((v2+p)<=b)){
					z1=z1+""+'0';
					z2=z2+""+'1';
					v2+=p;
				}

				else{
					z1=z1+"0";
					z2=z2+"0";
				}

			}
			else{
				if(((v1+p-1)>=a)){
					z1=z1+""+'0';
					z2=z2+""+'1';
					v2+=p;
				}

				else{
					z1=z1+"1";
					z2=z2+"1";
				}

			}
			p/=2;
		}

		System.out.println(Long.parseLong(z1,2)^Long.parseLong(z2,2));
	}
	static class paint implements Comparable<paint>{
		int clr;
		HashSet<Integer> hs;
		public paint(int x){
			clr=x;
			hs=new HashSet<Integer>();
		}
		public  int compareTo(paint o){
			if(o.hs.size()!=hs.size())
				return o.hs.size()-hs.size();
			else
				return clr-o.clr;
			}
	}
    public static int pow(int x,int y){
        int ans=1;
        while(y>0){
            if(y%2==1)
                ans*=x;
            x*=x;

            y/=2;

        }
        return ans;
    }
    public static class s {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /** call this method to initialize reader for InputStream */
        static void init(InputStream input) {
            reader = new BufferedReader(
                        new InputStreamReader(input) );
            tokenizer = new StringTokenizer("");
        }

        /** get next word */
        static String next() throws IOException {
            while ( ! tokenizer.hasMoreTokens() ) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                    reader.readLine() );
            }
            return tokenizer.nextToken();
        }

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

        static double nextDouble() throws IOException {
            return Double.parseDouble( next() );
        }
        static long nextLong() throws IOException {
            return Long.parseLong( next() );
        }

    }
}

import java.util.*;
import java.io.*;
public class cf_Little_Girl_and_Maximum_XOR {
	static long l,r;
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out=new PrintWriter(System.out);
		StringBuilder answer=new StringBuilder();
		StringTokenizer tok=new StringTokenizer(br.readLine()," ");
		l=Long.parseLong(tok.nextToken().trim());
		r=Long.parseLong(tok.nextToken().trim());
		//onetrickgreedy
		answer.append(greedy());
		out.println(answer);
		out.close();
	}
	static long greedy() {
		long xor=l^r;
		int firstbitpos=0;
		while(xor>0) {
			xor>>=1;
			firstbitpos++;
		}
		int one=1;
		long ans=0;
		while(firstbitpos-->0) {
			ans+=one;
			one<<=1;
		}
		return ans;
	}
}

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

public class test {
    static boolean DEBUG_FLAG = false;
    int INF = (int)1e9;
    long MOD = 1000000007;

    static void debug(String s) {
        if(DEBUG_FLAG) {
            System.out.print(s);
        }
    }

    String bin(long x) {
        if(x<=0) return "0";
        if(x==1) return "1";
        return bin(x/2) + (x%2);
    }

    long dec(String s) {
//        System.out.println("s: "+s);
        if(s.length()==0) return 0;
        return 2 * dec(s.substring(0, s.length()-1)) + (s.charAt(s.length()-1)-'0');
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        long l = in.nextLong();
        long r = in.nextLong();
        String a = bin(l);
        String b = bin(r);
        while(a.length()!=b.length()) {
            a = "0"+a;
        }
        String rs = "";
        boolean f = false;
        for(int i=0; i<b.length(); i++) {
            int x = b.charAt(i)-'0';
            int y = a.charAt(i)-'0';
            if(f) {
                rs = 1 + rs;
            } else {
                if(x==1) {
                    if(y==0) {
                        rs = 1 + rs;
                    } else {
                        rs = 0 + rs;
                        f = true;
                    }
                } else {
                    if(y==0) {
                        rs = 1 + rs;
                    } else {
                        rs = 1 + rs;
                    }
                    f = true;
                }
            }
        }
        long ans = dec(rs);
        out.println(ans);
    }

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new test().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }

    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	 public void solve(InputReader in, PrintWriter out) {
    		 long l = in.nextLong();
    		 long r = in.nextLong();
    		 if (l == r) {
    			 out.println(0);
    			 return;
    		 }
    		 long max = 0;
    		 int lenL = (int)(Math.log10(l)/Math.log10(2));
    		 int lenR = (int)(Math.log10(r)/Math.log10(2));
    		 if (lenL < lenR) {
    			 max += ((long)1 << (lenR + 1)) - 1;

    		 }
    		 else {
    			 int len = (int)(Math.log10(r ^ l)/Math.log(2));
    			 out.println(len);
    			 for (int i = 0; i <= len; i++)
    				 max += (long)1 << i;
    		 }
    		 out.println(max);
     	 }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

import java.util.*;
import java.math.*;
public class Main {
    public static void main(String args[]) {
        // Your Code Here
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong(),b=sc.nextLong();
		long xor=0;
	    long bit[] = new long[32];
		Arrays.fill(bit,1);
		for(int i=0;i<32;i++){
             long mask = 1<<(31-i);
			 long x = (a&mask)==0?0:1;
			 long y = (b&mask)==0?0:1;
			 if(x!=y)
			 break;
			 else
			 bit[31-i]=0;
		}
        for(int i=0;i<32;i++){
			long j = (long)Math.pow(2,i);
			xor+=bit[i]*j;
		}
		System.out.println(xor);
    }
}

import java.util.Scanner;

public class D {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long L = in.nextLong(), R = in.nextLong(), ans = 0;
        int start = 0;
        for(int i = 63; i >= 0; i--)
            if(((R>>i)&1) == 1)
            {
                start = i;
                break;
            }
        for(int i = start; i >= 0; i--)
        {
            boolean a = (((L>>i)&1) == 1), b = (((R>>i)&1) == 1);
            if(!(a&b))
                ans |= (1<<i);
        }

        System.out.println(ans);
    }
}

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

public class Solution{
	static PrintWriter out=new PrintWriter(System.out);
	public static void main (String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] temp=br.readLine().trim().split(" ");

	    long l=Long.parseLong(temp[0]);
	    long r=Long.parseLong(temp[1]);

	    out.println(maxXor(l,r));

		out.flush();
		out.close();
	}
	public static long maxXor(long l,long r)
	{
	    long ans=l^r;
	    for(int i=0;i<63;i++){
	        if( (l&(1L<<i)) != 0  && (r&(1L<<i)) != 0 )
	        {
	            long temp=(l^(1L<<i));
	            if(temp>=l){
	                ans=(ans|(1L<<i));
	            }
	            else{
	                break;
	            }
	        }
	        else if((l&(1L<<i)) == 0  && (r&(1L<<i)) == 0){
	            long temp=(l|(1L<<i));
	            if(temp<=r)
	            {
	                ans=(ans|(1L<<i));
	            }
	            else{
	                break;
	            }
	        }
	    }
	    return ans;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

import javax.swing.event.CellEditorListener;

public class moor {

	static class pair implements Comparable<pair> {
		String x;
		int y;

		pair(String i, int j) {
			x = i;
			y = j;
		}

		@Override
		public int compareTo(pair o) {
			return (this.y - o.y);
		}
	}

	/*
	 * 1. Sieve of Eratosthenes: generate all primes in [2, N]
	 */
	static ArrayList<Integer> primes;
	static int[] isComposite;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st=new StringTokenizer(br.readLine());
		char min[] = Long.toBinaryString(Long.parseLong(st.nextToken())).toCharArray();
		char max[] = Long.toBinaryString(Long.parseLong(st.nextToken())).toCharArray();
		long ans = 0;
		if (max.length > min.length) {
			for (int i = 0; i < max.length; i++) {
				ans += Math.pow(2, i);
			}
			pw.print(ans);

		} else {
			int i=0;
			for (i = 0; i < max.length; i++) {
				if(max[i]!=min[i])
					break;
			}
			for (int j = 0; j < min.length-i; j++) {
				ans += Math.pow(2, j);
			}
			pw.print(ans);
		}
		pw.flush();

	}

}

import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.InputMismatchException;

public class max_xor {

    public static void main(String s[]) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        solve(in,out);
        out.close();
    }

    public static void solve(InputReader in, OutputWriter out) {
        long L = in.readLong();
        long R = in.readLong();

        int bit = 63;
        while(bit >= 0 && ((1L<<bit & L) == (1L<<bit & R)) ){
           bit--;
        }

        out.printLine((1<<bit+1) -1);
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }
}

class OutputWriter {

    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public final class LittleGirlAndMaximumXOR {
	static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[64]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}
			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}

	private static long nonLeadingZeroComplement(long i) {
		long ones = (Long.highestOneBit(i) << 1) - 1;
		return i ^ ones;
	}

	public static void main(String args[]) throws IOException {
		Reader reader = new Reader();

		long l = reader.nextLong();
		long r = reader.nextLong();

		if (r == l) {
			System.out.println(0);
			return;
		}

		long max = Long.MIN_VALUE;
		long mask = nonLeadingZeroComplement(r);
		long i = mask;
		for (; i > 0; i = (i - 1) & mask) {
			if (i >= l) {
				max = Math.max(max, r ^ i);
			}
		}

		System.out.println(max);
	}
}

import java.util.*;
public class hii{

	public static void main(String s[]){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		int arr1[] = calc(a);
		int arr2[] = calc(b);
		for(int i=64;i>=0;i--){
			if(arr2[i]==-1)
				continue;
			if(arr1[i]==1 && (arr2[i]==1)){
				long temp = b;
				temp-=Math.pow(2,i);
				if(temp>=a){
					b=temp;
				}
			}else if(arr2[i]==0 && (arr1[i]==-1 ||arr1[i]==0)){
				long temp = a;
				temp+=Math.pow(2,i);
				if(temp<=b){
					a=temp;
				}
			}
		}
		System.out.println(a^b);
	}

	public static int[] calc(long n){
		int arr[] = new int[65];
		Arrays.fill(arr,-1);
		int pos=0;
		while(n>0){
			long f = (n&1);
			arr[pos]=(int)f;
			pos++;
			n=n>>1;
		}
		return arr;
	}
}

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

public class A {

	public static void main(String[] args) {
		FastReader in = new FastReader();
		long low = in.nextLong(), high = in.nextLong();
		if(low==high) {
			System.out.println(0);
			return;
		}
		String lBin = Long.toBinaryString(low),hBin = Long.toBinaryString(high);
		int diff = hBin.length()-lBin.length();
		String ans = "";
		boolean isSame = true,flipLow = false,flipHigh = false;;
		for(int i=0;i<diff;i++) ans+=hBin.charAt(i);
		if(diff>0) isSame = false;
//		System.out.println(hBin.length()+" "+lBin.length());
		for(int i=diff;i<hBin.length();i++) {
//			System.out.println(isSame);
			if(hBin.charAt(i)==lBin.charAt(i-diff) && isSame) {
				ans += '0';
				continue;
			}
			if(hBin.charAt(i)!=lBin.charAt(i-diff) && isSame) {
				isSame = false;
				ans+='1';
				continue;
			}
			if(hBin.charAt(i)=='1' && lBin.charAt(i-diff)=='1') {
				if(!isSame) {
					ans+='1';
					flipHigh = true;
					continue;
				}
				if(flipLow) {
					ans+='1';
					continue;
				}
				ans+='0';
			}
			if(hBin.charAt(i)=='0' && lBin.charAt(i-diff)=='0') {
				if(flipHigh) {
					ans+='1';
					continue;
				}
				if(!isSame) {
					ans+='1';
					flipLow = true;
					continue;
				}
				ans+='0';
			}
			if(hBin.charAt(i)!=lBin.charAt(i-diff)) ans+='1';
		}
		System.out.println(Long.parseLong(ans,2));
	}

	static final Random random=new Random();
	//	static void ruffleSort(Pair[] a) {
	//		int n=a.length;//shuffle, then sort
	//		for (int i=0; i<n; i++) {
	//			int oi=random.nextInt(n);
	//			Pair temp=a[oi];
	//			a[oi]=a[i]; a[i]=temp;
	//		}
	//		Arrays.sort(a);
	//	}
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	static void ruffleSort(char[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n);
			char temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException  e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}

		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
	}
}

//class Pair implements Comparable<Pair>{
//    int a;
//    int b;
//    public Pair(int a, int b) {
//        this.a = a;
//        this.b = b;
//    }
//    public int compareTo(Pair o) {
//        if(this.a==o.a)
//            return this.b - o.b;
//        return this.a - o.a;
//    }
//}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nguyen Trung Hieu - vuondenthanhcong11@gmail.com
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int from = in.readInt();
        int to = in.readInt();

        long x = 0;
        long y = 0;

        for (int i = 0; i < 63; i++) {
            long curX = x | (1L << i);
            long curY = y | (1L << i);

            if ((x < from && curX <= to) || (curY > to && curX <= to))
                x = curX;
            else if ((y < from && curY <= to) || (curX > to && curY <= to))
                y = curY;
        }

        if (x < from || y < from)
            out.printLine(0);
        else
            out.printLine(x ^ y);
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}

/*  convert each # to binary, subtract the two
if number is <= 11, print number
else, is the difference as all 1s, convert back to base 10
*/

import java.util.*;

public class LittleGirlMaxXOR
{
	public static final double START_BASE = 10;
	public static final double FINAL_BASE = 2;
	public static final int CUTOFF = 11;

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int l = in.nextInt();
		int r = in.nextInt();
		// check for exceptions in lines above

		//long l2Bin = convert2Bin(l, 0);
		//long r2Bin = convert2Bin(r, 0);

		long diff = convert2Bin(l ^ r,0);

		if (diff <= CUTOFF)
		{
			long ans = Long.parseLong(Long.toString(diff),(int) FINAL_BASE);
			System.out.println(ans);
		}
		else
		{
			System.out.println(diff);
			/*convert to string, then change every digit to 1, convert to decimal*/
			long ans = 0;
			for (double i = 0; i < String.valueOf(Long.toString(diff)).length(); i++)
			{
				ans += (long) Math.pow(START_BASE,i);
			}
			System.out.println(ans);
			ans = Long.parseLong(Long.toString(ans),(int) FINAL_BASE);
			System.out.println(ans);
		}
	}

	public static int convert2Bin(int rem, int bin)
	{
		double exp = 0;
		if (rem > 1)
		{
			int temp = rem;
			while (temp > FINAL_BASE-1)
			{
				temp = temp/(int) FINAL_BASE;
				exp++;
			}
			bin = bin + (int) Math.pow(START_BASE,exp);
			rem = rem % (int) (Math.pow(FINAL_BASE,exp));
			return convert2Bin(rem,bin);
		}
		else
		{
			return bin + rem;
		}

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {
	static BufferedReader in;
	static StringTokenizer st;
	static PrintWriter out;
	public static void main(String[] args) throws IOException {
		begin();
		solve();
		end();
	}
	private static void end() {
		out.close();
	}
	private static void solve() throws IOException {
		long l = nextLong();
		long r = nextLong();
		int p = 63;
		while (p >= 0 && hing(l,p) == hing(r,p)){
			p--;
		}
		write((1<<(p+1))-1);

	}
	private static boolean hing(long x, int bit) {
		return (x&(1<<bit)) != 0;
	}
	private static long nextLong() throws  IOException {
		return Long.parseLong(next());
	}
	private static void writeln(Object t) {
		out.println(t);
	}
	private static void write(Object t) {
		out.print(t);
	}
	private static int nextInt() throws  IOException {
		return Integer.parseInt(next());
	}
	private static String next() throws IOException {
		while (!st.hasMoreElements())
			st = new StringTokenizer(in.readLine());

		return st.nextToken();
	}
	private static void begin() {
		out = new PrintWriter(new OutputStreamWriter(System.out));
		st = new StringTokenizer("");
		in = new BufferedReader(new InputStreamReader(System.in));
	}

}

import java.util.Scanner;

public class LittleGirlMaxXOR {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long l = scan.nextLong();
		long r = scan.nextLong();
		if(l == r){
			System.out.println(0);
			return;
		}
		String a = Long.toBinaryString(l);
		String b = Long.toBinaryString(r);
		while(a.length() < 64){
			a = "0"+a;
		}
		while(b.length() < 64){
			b = "0"+b;
		}
		int idx = 0;
		for(int i = 0; i < 64; i++){
			if(a.charAt(i) != b.charAt(i)){
				idx = 64-i;
				break;
			}
		}
		long ans = (long) (Math.pow(2, idx)-1);
		System.out.println(ans);
	}
}

import java.util.Scanner;

public class D {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String l = Long.toBinaryString(in.nextLong());
        String h = Long.toBinaryString(in.nextLong());
        if (l .equals(h)) {
            System.out.println(0);
        } else {
            for (int i = 0; i < h.length() - l.length(); i++) {
                l = "0" + l;
            }
            char[] low = l.toCharArray();
            char[] high = h.toCharArray();
            int i;
            for (i = 0; i < high.length; i++) {
                if (high[i] > low[i]) {
                    break;
                }
            }
            i++;
            for (; i < high.length; i++) {
                high[i] = '1';
            }
            String ans = "";
            for (int j = 0; j < high.length; j++) {
                ans = ans + high[j];
            }
            System.out.println(Long.parseLong(ans, 2));
        }
    }

}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

  static class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new
          InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

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

    String[] nextSArray() {
      String sr[] = null;
      try {
        sr = br.readLine().trim().split(" ");
      } catch (IOException e) {
        e.printStackTrace();
      }
      return sr;
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }

      return str;
    }
  }

  //  static int MOD=1000000000+7;
//  public static void sortbyCol(int arr[][],int col)
//  {
//    Arrays.sort(arr,new Comparator<int[]>(){
//      @Override
//      public int compare(int[] o1, int[] o2) {
//        // To sort in descending order revert
//        // the '>' Operator
//        if(o1[col]>o2[col])
//          return 1;
//        else
//          return -1;
//      }
//    });
//  }

  public static void main(String[] args) throws java.lang.Exception {
    FastReader sc = new FastReader();
//   int t1=sc.nextInt();
//   for(int t=0;t<t1;++t)
//   {
//
//
//   }
    long a=sc.nextLong();
    long b=sc.nextLong();
    if(a==b)
    {
      System.out.println(0);
      return;
    }
    long bit=(long) Math.pow(2,10);
    int x=0,y=0;
    while(bit>0)
    {
      if((a&bit)!=(b&bit))
      {
        break;
      }
      bit=bit>>1;
    }
    long ans=bit|(bit-1);
    out.println(ans);
    out.flush();
    out.close();

  }

}

// out.println(al.toString().replaceAll("[\\[|\\]|,]",""));

import java.math.BigInteger;
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author yousefbj
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n1 = sc.nextLong();
        long n2 = sc.nextLong();
         int m1=mostSignificantBit(n1);
           int m2=mostSignificantBit(n2);

          if(m1==m2){
              if(m1==1&m2==1){
                  System.out.println("0");
              }else{
                  while(true){
            m1=mostSignificantBit(n1);
            m2=mostSignificantBit(n2);

         if(m1==m2){

            n1^=((long)1<<m1-1);
            n2^=((long)1<<m2-1);

         }   else if(m1>m2){
             System.out.println((long)Math.pow(2, m1)-1);
             break;
         }else{

             System.out.println((long)Math.pow(2, m2)-1);
             break;
         }
        }
              }

          }else{
        if(n1>n2){
            System.out.println( (long)Math.pow(2,n1 -1)+1);
        }else{

            System.out.println((long)Math.pow(2,n2 -1)+1);
        }

    }
    }
    static int log(long x, int base)
{
    return (int) (Math.log(x) / Math.log(base));
}
static int mostSignificantBit(long myInt){
    int i = 0;
    while (myInt != 0) {
        ++i;
        myInt >>>= 1;
    }
    return i;
}

}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class Test {
	public static long l, r;
	static long dp[][][];
	public static long rec(int i, int lstate, int rstate) {

		if (i < 0)
			return 0;

		long lc = l & ((long)1 << i);
		long rc = r & ((long)1 << i);

		if(dp[i][lstate][rstate] != -1) return dp[i][lstate][rstate];

		long max = 0;
		for (int newl = 0; newl <= 1; ++newl) {
			for (int newr = 0; newr <= 1; ++newr) {
				int nlstate = lstate;
				int nrstate = rstate;
				if (lstate == 1) {
					if (newl == 0) {
						if (lc > 0) {
							continue;
						} else {
							nlstate = 1;
						}
					}
				}
				if (rstate == 1) {
					if (newr == 0) {
						if (rc > 0) {
							nrstate = 0;
						} else {
							nrstate = 1;
						}
					} else {
						if (rc > 0) {
							nrstate = 1;
						} else {
							continue;
						}
					}
				}
				long now = (long)((newl ^ newr) * Math.pow(2, i));
				long calc = now + rec(i - 1, nlstate, nrstate);
				//System.out.println(i + " / " + newl + " / " + newr + " / " + now + " / " + calc);
				max = Math.max(max, calc);
			}
		}

		return dp[i][lstate][rstate] = max;

	}

	public static void main(String[] argv) {
		FastScanner scan = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		l = scan.nextLong();
		r = scan.nextLong();
		if(l == r) {
			out.println(l ^ r);
			out.close();
			return;
		}

		dp = new long[64][2][2];
		for(int i = 0; i < 64; ++i)
			for(int j = 0; j < 2; ++j)
				for(int k = 0; k < 2; ++k)
					dp[i][j][k] = -1;
		int t = 0;
		while(((long)1 << t) < r) ++t;
		out.println(rec(t, 1, 1));
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(InputStream is) {
			try {
				br = new BufferedReader(new InputStreamReader(is));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					return null;
				}
			}
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.valueOf(next());
		}
	}
}

import java.util.*;
import java.math.*;
import java.io.*;
 import java.text.DecimalFormat;
public class Main{
    static int[] arr;
    static String h;
    public static void main(String[] args)  throws IOException {
        s.init(System.in);
        PrintWriter out = new PrintWriter(System.out);

        long a,b;
        String x,y,z1,z2;
        a=s.nextLong();
        b=s.nextLong();
        y=Long.toBinaryString(b);
        x=Long.toBinaryString(a);

        while(x.length()<y.length())
            x="0"+x;
        int flag1,flag2;
        flag1=flag2=0;
        long v1,v2;
        v1=v2=0;
        z1=z2="";
        long p=(long)Math.pow(2,x.length()-1);
        for(int i=0;i<y.length();i++){
            char c,d;
            c=x.charAt(i);
            d=y.charAt(i);
            if(c!=d){
                z1=z1+""+c;
                z2=z2+""+d;
                if(c=='0')
                    v2+=p;
                else
                    v1+=p;
            }

            else if(c=='0'&&d=='0'){
                 if(((v1+p)<=b)){
                    z1=z1+""+'1';
                    z2=z2+""+'0';
                    v1+=p;
                }

                else{
                    z1=z1+"0";
                    z2=z2+"0";
                }

            }
            else{
              if(((v2+p-1)>=a)){
                    z1=z1+""+'1';
                    z2=z2+""+'0';
                    v1+=p;
                }
                else{
                    z1=z1+"1";
                    z2=z2+"1";
                }

            }
            p/=2;
        }

        System.out.println(Long.parseLong(z1,2)^Long.parseLong(z2,2));
    }
    static class paint implements Comparable<paint>{
        int clr;
        HashSet<Integer> hs;
        public paint(int x){
            clr=x;
            hs=new HashSet<Integer>();
        }
        public  int compareTo(paint o){
            if(o.hs.size()!=hs.size())
                return o.hs.size()-hs.size();
            else
                return clr-o.clr;
            }
    }
    public static int pow(int x,int y){
        int ans=1;
        while(y>0){
            if(y%2==1)
                ans*=x;
            x*=x;

            y/=2;

        }
        return ans;
    }
    public static class s {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /** call this method to initialize reader for InputStream */
        static void init(InputStream input) {
            reader = new BufferedReader(
                        new InputStreamReader(input) );
            tokenizer = new StringTokenizer("");
        }

        /** get next word */
        static String next() throws IOException {
            while ( ! tokenizer.hasMoreTokens() ) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                    reader.readLine() );
            }
            return tokenizer.nextToken();
        }

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

        static double nextDouble() throws IOException {
            return Double.parseDouble( next() );
        }
        static long nextLong() throws IOException {
            return Long.parseLong( next() );
        }

    }
}

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

public class ProblemD {
    InputReader in; PrintWriter out;
    void solve() {
        long l = in.nextLong();
        long r = in.nextLong();
        long ans = 0;
        for (int k = 62; k >= 0; k--) {
            long cb = (1L << k);
            long tmp = (l | cb);
            tmp = (tmp & cb);
            if (tmp <= r)
                ans += (1L << k);
        }
        out.println(ans);
    }

    ProblemD(){
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        try {
            if (oj) {
                in = new InputReader(System.in);
                out = new PrintWriter(System.out);
            }
            else {
                Writer w = new FileWriter("output.txt");
                in = new InputReader(new FileReader("input.txt"));
                out = new PrintWriter(w);
            }
        } catch(Exception e) {
            throw new RuntimeException(e);
        }
        solve();
        out.close();
    }
    public static void main(String[] args){
        new ProblemD();
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public InputReader(FileReader fr) {
        reader = new BufferedReader(fr);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }

}

import java.util.Scanner;

public class D {
	int dp[][] = new int[100][3];

	public static void main(String[] args) {
		Scanner myScanner = new Scanner(System.in);
		l = myScanner.nextLong();
		r = myScanner.nextLong();
		long res = 0;
		boolean ok = false;
		int start = 0;

		for (int i = 0; i < 63; i++)
			if ((r & (1l << i)) > 0)
				start = i;

		for (int i = start; i >= 0; i--) {
			if (!ok && (l & (1l << i)) > 0) {

				res |= (1l << i);
				long tmp = r;

				tmp |= (1l << i);
				tmp ^= (1l << i);
				if (tmp >= l)
					r = tmp;

			} else if ((r & (1l << i)) == 0) {

				if ((l & (1l << i)) == 0)
					ok = true;

				res |= (1l << i);
			}
		}

		System.out.println(res ^ r);
	}

	static long l, r;
}

import java.util.Arrays;
import java.util.Scanner;

public class LittleGirlAndMaximumXOR {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		for(int i = 8; i <= 16; i++)
		{
			for(int j = i; i <= 16; i++)
			{

			}
		}

		long l = sc.nextLong();
		long r = sc.nextLong();

		String sl = Long.toBinaryString(l);
		String sr = Long.toBinaryString(r);

		boolean[] a = new boolean[60];
		boolean[] b = new boolean[60];
		boolean[] c = new boolean[60];

		int d = 0;
		for(int i = sl.length()-1; i >= 0; i--)
		{
			a[59-d] = sl.charAt(i) == '1';
			d++;
		}

//		System.out.println(sr);
//		System.out.println(sl);

		d = 0;
		for(int i = sr.length()-1; i >= 0; i--)
		{
			b[59-d] = sr.charAt(i) == '1';
			d++;
		}

		int leftera = -1;
		int lefterb = -1;

		for(int i = 0; i < 60; i++)
		{
			if(leftera == -1 && a[i])
				leftera = i;
			if(lefterb == -1 && b[i])
				lefterb = i;
		}

//		System.out.println(Arrays.toString(a));
//		System.out.println(Arrays.toString(b));

//		System.out.println(leftera + " " + lefterb);

	//	System.out.println("Lefterb " + lefterb + ", a " + leftera);
		{
			boolean armageddon = false;
			for(int i = lefterb; i < 60; i++)
			{
				if(!armageddon)
				{
					if(b[i] == a[i])
					{
						c[i] = false;
					}
					else
					{
						armageddon = true;
						c[i] = true;
					}
				}
				else
				{
					c[i] = true;
				}

			}
		}

		long res = 0;

		for(int i = 0; i < 60; i++)
		{
			if(c[i])
				res += Math.pow(2, 59-i);
		}
//		System.out.println(Arrays.toString(c));

		System.out.println(res);

	}

}

//package practice;
import java.util.*;
import java.io.*;

public class Practice {

    public static StringBuilder binary(long a)
    {
        StringBuilder ans=new StringBuilder();
        while(a!=0)
        {
            if(a%2==1)
                ans.append("1");
            else
                ans.append("0");

            a=a>>1;
        }
        return ans;
    }

    public static void main(String args[])
    {
      InputReader in=new InputReader(System.in);
      long l=in.nextLong();
      long r=in.nextLong();

      StringBuilder a=binary(l);
      StringBuilder b=binary(r);

      for(int i=0;i<b.length()-a.length();i++)
          a.append('0');
      a=a.reverse();
      b=b.reverse();

      int index=Integer.MAX_VALUE;
      for(int i=0;i<a.length();i++)
      {
         if(a.charAt(i)=='0'&&b.charAt(i)=='1'){
                index=i;
                  break;}

      }
      //System.out.println(" The string a is "+a);
      //System.out.println(" The sTrig b is "+b);

      StringBuilder ans=new StringBuilder();
      long main=0;
      for(int i=0;i<a.length();i++)
      {
          if(i<index)
          {
              //ans.append(b.charAt(i));
              ans.append('0');
          }
          else
          {
//              if(b.charAt(i)=='0')
//                  ans.append('1');
//              else
//                  ans.append('0');
              ans.append("1");
          }

      }
     // System.out.println("The ans is "+ans);
      ans.reverse();

      for(int i=0;i<a.length();i++)
      {
          main=main+(ans.charAt(i)-'0')*(int)Math.pow(2,i);
      }
      System.out.println(main);

    }

 static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextInt();

            return array;
        }

        public long nextLong() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sign = 1;

            if (c == '-') {
                sign = -1;

                c = read();
            }

            long result = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                result *= 10;
                result += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return result * sign;
        }

        public long[] nextLongArray(int arraySize) {
            long array[] = new long[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextLong();

            return array;
        }

        public float nextFloat() // problematic
        {
            float result, div;
            byte c;

            result = 0;
            div = 1;
            c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean isNegative = (c == '-');

            if (isNegative)
                c = (byte) read();

            do {
                result = result * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    result += (c - '0') / (div *= 10);

            if (isNegative)
                return -result;

            return result;
        }

        public double nextDouble() // not completely accurate
        {
            double ret = 0, div = 1;
            byte c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean neg = (c == '-');

            if (neg)
                c = (byte) read();

            do {
                ret = ret * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);

            if (neg)
                return -ret;

            return ret;
        }

        public String next() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);

                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String nextLine() {
            int c = read();

            StringBuilder result = new StringBuilder();

            do {
                result.appendCodePoint(c);

                c = read();
            } while (!isNewLine(c));

            return result.toString();
        }

        public boolean isNewLine(int c) {
            return c == '\n';
        }

        public void close() {
            try {
                stream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

}

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

public class a556{

	public static void main(String[] args) throws Exception
    {
	   //new FileInputStream("input.txt");
		//new FileOutputStream("output.txt")
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
  		long l=in.rl();
  		long r=in.rl();
  		long ans=0;
  		long setbit;
  		if(l<r){
			for(int i=64;i>=0;i--){
				setbit=1L<<i;
				if((((r&setbit)>0)&&(l<setbit))||(((l&setbit)>0)&&(r<setbit))){
					ans=setbit^(setbit-1);
					break;
				}
				else if(((r&setbit)>0)&&((l&setbit)>0)){
					r=r^(~setbit);
					l=l^(~setbit);
				}
			}
		}
		out.pl(ans);
		out.close();
	}
private static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (numChars <= 0)
				return -1;
			}
			return buf[curChar++];
		}

		public String rs()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

		public int ri()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public double rd() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, ri());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, ri());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

		public long rl() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	private static class OutputWriter
	{
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream)
		{
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer)
		{
			this.writer = new PrintWriter(writer);
		}
 		public void print(Object... objects)
		{
			for (int i = 0; i < objects.length; i++)
			{
				if (i != 0)
				writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void pf(double n)
		{
			writer.printf("%.9f%n", n);
		}
		public void pl(Object... objects)
		{
			print(objects);
			writer.println();
		}

		public void close()
		{
			writer.close();
		}

		public void flush()
		{
			writer.flush();
		}

	}
}

import java.util.*;
import java.io.*;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        //String[] buf = reader.readLine().split(" ");
        long a = sc.nextLong(), b = sc.nextLong();
        long ans = help(a,b);
        System.out.println(ans);
    }
    // here we think a<=b
    static long help(long a, long b){
        if(a>b){
            long c =a;
            a = b; b = c;
        }
        if(a==b) return 0;
        if(a==0) return b;
        int len1 = Long.toString(a,2).length(), len2 = Long.toString(b,2).length();
        if(len1<len2) return (1L<<len2)-1;
        a -= 1L<<(len1-1); b -= 1L<<(len2-1);
        return help(a,b);
    }
}

import java.util.*;
import java.lang.*;

public class hack
{
    public static void main(String[] args)
    {
    	Scanner sc = new Scanner(System.in);
    	int l = sc.nextInt();
    	int r = sc.nextInt();
    	int count = 0;
    	int temp = r;
    	while((temp&1) == 0)
    	{
    		count++;
    		temp = (temp>>1);
    	}
    	int max =(int) Math.pow(2,count)-1;
    	if(max>l)
    	{
    		System.out.println(r^max);
    	}
    	else{
    		System.out.println(l^r);
    	}
    	sc.close();
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author vadimmm
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long l = in.nextLong();
        long r = in.nextLong();
        long answer = 0;
        long max = 1;
        for (int i = 0; i < 64; ++i) {
            max <<= 1;
            if (max > r) {
                max >>= 1;
                break;
            }
        }
        if (max - 1 >= l) {
            out.println(max ^ (max - 1));
            return;
        }
        out.println(max ^ r);
    }
}

class InputReader {

    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        stringTokenizer = null;
    }

    public String next() {
        while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

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

    }

import java.io.*;
import java.util.*;
public class D276
{
    public static void main(String args[])throws IOException
    {
        Scanner sc=new Scanner(System.in);
        long l=sc.nextInt();
        long r=sc.nextInt();
        String s1=Long.toString(l,2);
        String s2=Long.toString(r,2);
        long res=0;
        if(s1.length()<s2.length())
        {
            String temp=s1;
            s1=s2;
            s2=temp;
        }
        int max=s1.length(),min=s2.length();
        //System.out.println(s1+" "+s2);
        if(max!=min)
        {
            res=(long)Math.pow(2,min)-1;
            for(int i=0;i<max;i++)
            {
                if(max-i !=min)
                {
                    if(s1.charAt(i)=='1')
                        res+=(long)Math.pow(2,max-i-1);
                }
                else
                    break;
            }
            System.out.println(res);
        }
        else
        {
            for(int i=0;i<max;i++)
            {
                if(s1.charAt(i)=='1' && s2.charAt(i)=='0')
                {
                    res=(long)Math.pow(2,max-i)-1;
                    break;
                }
            }
            System.out.println(res);
        }
    }
}

/**
 * Created with IntelliJ IDEA.
 * User: Venky
 */
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws IOException {
        long l = nextLong();
        long r = nextLong();
        if(l == r)
        {
            out.println("0");
            return;
        }
        String binaryL = Long.toBinaryString(l);
        StringBuffer binaryR = new StringBuffer(Long.toBinaryString(r));
        boolean flag1 = false;
        for(int i=0;i<binaryR.length() - binaryL.length();i++)
        {
            if(binaryR.charAt(i) == '0')
            {
                binaryR.setCharAt(i, '1');
                flag1 = true;
            }
        }
        int nowInd = binaryR.length() - binaryL.length();
        for(int i=nowInd; i<binaryR.length(); i++)
        {
            if(binaryR.charAt(i) == '1' && binaryL.charAt(i-nowInd) == '1')
            {
                if(!flag1)
                    binaryR.setCharAt(i, '0');
            }
            else if(binaryR.charAt(i) == '0')
            {
                binaryR.setCharAt(i, '1');
                if(binaryL.charAt(i-nowInd) == '0')
                    flag1 = true;
            }
        }
        long ans = Long.parseLong(binaryR.toString(), 2);
        if(ans == l)
            out.println("0");
        else out.println(ans);
    }

    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        InputStream input = System.in;
        PrintStream output = System.out;
        br = new BufferedReader(new InputStreamReader(input));
        out = new PrintWriter(output);
        solve();
        out.close();
    }

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

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

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

    static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }
}

import java.util.Scanner;

/**
 * @Created by sbhowmik on 09/10/18
 */
public class LittleGirlAndXor {

    public static void main(String []args) {

        Scanner scanner = new Scanner(System.in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        long xor = Integer.MIN_VALUE;
        for (long k = a -1; a <=b; a++) {
            long z = (k^(k-1));
            if (z > xor) {
                xor = z;
            }
        }
        System.out.print(xor);
    }
}

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

public class B287 implements Runnable {

	public void solve() throws IOException {
		int cnt = -1;
                long l = nextLong();
                long r = nextLong();
                if(l == r){
                        System.out.println(0);
                        return;
                }

                for(int i = 63; i>=0; i--){
                        if((l & (1 << i)) != (r & (1 << i))){ cnt = i; break; }
                }

                System.out.println( (1 << (cnt + 1)) - 1);
	}

	//-----------------------------------------------------------
	public static void main(String[] args) {
		new B287().run();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			tok = null;
			solve();
			in.close();
		} catch (IOException e) {
			System.exit(0);
		}
	}

	public String nextToken() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

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

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

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

	BufferedReader in;
	StringTokenizer tok;
}

import java.util.*;
public class Main {
    public static void main(String args[]) {
        // Your Code Here
		Scanner scn = new Scanner(System.in);
		long x1 = scn.nextLong();
		long y1 = scn.nextLong();
		String x = Long.toBinaryString(x1);
		String y = Long.toBinaryString(y1);
		int len = x.length();

		for (int i=1; i<=(y.length()-len);i++){
				x = '0'+x;
		}
		int flag = 0;
		while ((flag< y.length()) && (x.charAt(flag)-48)==(y.charAt(flag)-48)){
			flag++;
		}
		// System.out.println(flag);
		int sum =0;
		for (int i =0; i<(y.length()-flag);i++){
			sum += (1<<i);
		}
		System.out.println(sum);
    }
}

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7
{
	static class Pair
	{
		int x;
		int y;
		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
	}
	static int mod=100000000;
	public static int[] sort(int[] a)
	{
		int n=a.length;
		ArrayList<Integer> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++)
		{
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++)
		{
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b)
    {
        long result=1;
        while(b>0)
        {
            if (b % 2 != 0)
            {
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }

    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b)
	{
		return a*(b/gcd(a,b));
	}
	static ArrayList<ArrayList<Integer>> graph;
	static public void main(String args[])throws IOException
	{
		int tt=1;
		StringBuilder sb1=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++)
		{
			long l=l();
			long r=l();
		/*	String s1=Long.toBinaryString(l);
			String s2=Long.toBinaryString(r);
			int rem=64-s1.length();
			for(int i=0;i<rem;i++)
				s1="0"+s1;
			rem=64-s2.length();
			for(int i=0;i<rem;i++)
				s2="0"+s2;
			char[] ch1=new char[64];
			char[] ch2=new char[64];
			for(int i=0;i<64;i++)
			{
				ch1[i]=s1.charAt(i);
				ch2[i]=s2.charAt(i);
			}
			int flag=0;
			int smaller=0;
			long ans=0;
			pln(s2);
			pln(s1);
			for(int i=0;i<64;i++)
			{
				if(ans>0)
				pln(ans+"");
				if(ch2[i]=='1' && flag==0)
				{
					flag=1;
					if(ch1[i]=='0')
					{
						ans=ans+pow(2,s2.length()-i-1);
						smaller=1;
					}
				}
				else
				{
					if(ch2[i]=='0' && ch1[i]=='1')
					{
						ans=ans+pow(2,s2.length()-i-1);
					}
					else if(ch2[i]=='1' && ch1[i]=='0')
					{
						ans=ans+pow(2,s2.length()-i-1);
						smaller=1;
					}
					else if(ch2[i]=='0' && ch1[i]=='0')
					{
						if(smaller==1)
						{
							ans=ans+pow(2,s2.length()-i-1);
							for(int j=i+1;j<64;j++)
								ch1[j]='0';
						}
					}
					else if(ch2[i]=='1' && ch1[i]=='1')
					{

					}
				}
			}*/
			long i=64;
			for( i=64;i>=0;i--)
			{
			  if((l&(1<<i))!=(r&(1<<i)))
			  break;
			}
			long ans=1;
			for(int p=0;p<=i;p++)
			{
			  ans=ans*2;
			}
			ans-=1;

			pln(ans+"");
		}
		System.out.print(sb1.toString());
	}
	/**/
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	public static long l()
	{
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value)
	{
		System.out.println(value);
	}
	public static int i()
	{
		return in.Int();
	}
	public static String s()
	{
		return in.String();
	}
}
	class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars== -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int Int() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String String() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return String();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object...objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object...objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}

		public void flush() {
			writer.flush();
		}

		}

		class IOUtils {

		public static int[] readIntArray(InputReader in, int size) {
			int[] array = new int[size];
			for (int i = 0; i < size; i++)
				array[i] = in.Int();
			return array;
		}

	}

import java.util.Scanner;

/**
 * @Created by sbhowmik on 09/10/18
 */
public class LittleGirlAndXor {

    public static void main(String []args) {

        Scanner scanner = new Scanner(System.in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        long xor = Integer.MIN_VALUE;
        for (long k = a; k < b; k++) {
            long z = (k ^(k+1));
            if (z > xor) {
                xor = z;
            }
        }
        System.out.print(xor);
    }
}

import java.io.*;
import java.util.*;
public class Solution
{
    public static void main(String ag[])
    {
        Scanner sc=new Scanner(System.in);
        int i,j,k;
        long L=sc.nextLong();
        long R=sc.nextLong();

        int posL=findHighestSetBit(L);
        int posR=findHighestSetBit(R);

        long ans=0;
        if(posL!=posR)
        {
            ans=(1L<<(posR+1))-1;
        }
        else
        {
            for(i=63;i>=0;i--)
            {
                if((R&(1L<<i))>=1&&(L&(1L<<i))==0)
                {
                    ans=(1<<(i+1))-1;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
    public static int findHighestSetBit(long N)
    {
        for(int i=63;i>=0;i--)
        {
            if((N&(1L<<i))>=1)
            return i;
        }
        return 0;
    }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class cfvc15
{
	static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input)
    {
        reader = new BufferedReader( new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    static String next() throws IOException
    {
        while ( ! tokenizer.hasMoreTokens() )
        {
            tokenizer = new StringTokenizer(reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static long nextInt() throws IOException
    {
        return Long.parseLong( next() );
    }
	static PrintWriter writer;
	static void outit(OutputStream outputStream)
	{
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	static void print(Object...objects) {
		for (int i = 0; i < objects.length; i++)
		{
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	static void println(Object...objects) {
		print(objects);
		writer.println();
	}

	static void close() {
		writer.close();
	}

	static void flush() {
		writer.flush();
	}
	public static void print_a(long [] a)
    {
    	for(long i : a)
    	{
    		print(i+" ") ;
    	}
    	println() ;
    }
    public static void main(String [] args) throws IOException
    {
    	init(System.in) ;
    	outit(System.out) ;
//    	int t = (int) nextInt() ;
//    	for(int i =0 ; i<t ; i++)
    	output() ;
        flush();
        close();
    }
    static long mod = 1000000007 ;
    static ArrayList<ArrayList<Integer>> ar ;
    static int [] c ;
    public static void output() throws IOException
    {
    	long l = nextInt() ;
    	long r = nextInt() ;
    	String ls = Long.toBinaryString(l) ;
    	String rs = Long.toBinaryString(r) ;
    	int diff = rs.length()-ls.length() ;
    	for(int i = 0 ; i<diff ; i++)
    	{
    		ls = "0"+ls ;
    	}
//    	println(ls) ;
//    	println(rs) ;
    	int c = -1 ;
    	for(int i = 0 ; i<rs.length(); i++)
    	{
    		if(ls.charAt(i)!=rs.charAt(i))
    		{
    			c = i ;
    			break ;
    		}
    	}
    	if(c==-1)
    	{
    		println(0) ;
    	}
    	else
    	{
    		long ans = (long) (Math.pow(2,rs.length()-c-1)*2-1) ;
    		println(ans) ;
    	}
    }
}

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

public class ProblemD {
    InputReader in; PrintWriter out;
    void solve() {
        long l = in.nextLong();
        long r = in.nextLong();
        long ans = 0;
        for (int k = 62; k >= 0; k--) {
            long cb = (1L << k);
            long tmp = (l | cb);
            tmp = (tmp & cb);
            if (tmp <= r)
                ans += (1L << k);
        }
        out.println(ans);
    }

    ProblemD(){
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        try {
            if (oj) {
                in = new InputReader(System.in);
                out = new PrintWriter(System.out);
            }
            else {
                Writer w = new FileWriter("output.txt");
                in = new InputReader(new FileReader("input.txt"));
                out = new PrintWriter(w);
            }
        } catch(Exception e) {
            throw new RuntimeException(e);
        }
        solve();
        out.close();
    }
    public static void main(String[] args){
        new ProblemD();
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public InputReader(FileReader fr) {
        reader = new BufferedReader(fr);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }

}

import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);

        long l = scn.nextLong();
        long r = scn.nextLong();

        long a = 0;
        int i =0;
        long  n = r;
        while(r != 0){

            if((r&1) == 0){
                a = a|1<<i;
            }
            i++;
            r = r>>1;
        }
        i = 0;
        while(l > (a|1<<i)){
            i++;
        }
        System.out.println(n ^ (a | 1<<i));
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args)throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        MaximizingXor solver = new MaximizingXor();
        solver.solve(1, in, out);
        out.close();
    }

    static class MaximizingXor {
        public void solve(int testNumber, Reader in, PrintWriter out) throws Exception {

            long l = in.nextLong();
            long r = in.nextLong();

            String left = toBinary(l);
            String right = toBinary(r);

            long bitCountL = left.length();
            long bitCountR = right.length();

            long excess = bitCountR - bitCountL;
            for (int i = 0; i < excess; ++i) left = "0" + left;

            long start = bitCountR;
            for (int i = 0; i < bitCountR; ++i) {
                char chL = left.charAt(i);
                char chR = right.charAt(i);

                if (chL != chR) {
                    break;
                }

                --start;
            }
            out.println((long) (Math.pow(2, start) - 1));
        }

        private String toBinary(long n) {
            String res = "";
            while (n != 0) {
                long rem = n % 2;
                res = rem + res;
                n = n / 2;
            }
            return res;
        }

    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer;
        private int bytesRead;

        public Reader(InputStream in) {
            din = new DataInputStream(in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) {
                return -ret;
            }
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) {
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

    }
}

import java.util.*;

public class Dj {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long l = sc.nextLong();
		long r = sc.nextLong();

		if(l == r) {
			System.out.println(0);
			return;
		}

		long[] sq2 = new long[62];
		sq2[0] = 1;
		for(int i = 1; i < 62; i++) sq2[i] = sq2[i-1]*2;

		for(int i = sq2.length - 1; i >= 0; i--) {
			if(l > sq2[i] && r > sq2[i]) {
				l -= sq2[i];
				r -= sq2[i];
			} else if(l < sq2[i] && sq2[i] <= r) {
				System.out.println(sq2[i+1]-1);
				return;
			}
		}

	}
}

import java.util.*;
import java.io.*;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        //String[] buf = reader.readLine().split(" ");
        long a = sc.nextLong(), b = sc.nextLong();
        long ans = help(a,b);
        System.out.println(ans);
    }
    // here we think a<=b
    static long help(long a, long b){
        if(a>b){
            long c =a;
            a = b; b = c;
        }
        if(a==b) return 0;
        if(a==0) return b;
        int len1 = Long.toString(a,2).length(), len2 = Long.toString(b,2).length();
        if(len1<len2) return (1L<<len2)-1;
        a -= 1L<<(len1-1); b -= 1L<<(len2-1);
        return help(a,b);
    }
}

import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import org.omg.CORBA.INTERNAL;
import org.omg.CORBA.MARSHAL;
import sun.nio.cs.ext.MacThai;

import javax.swing.plaf.basic.BasicTreeUI;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Main {
    private static Scanner sc;
    private static Printer pr;
    static boolean []visited;
    static int []color;
    static int []pow=new int[(int)3e5+1];
    static int []count;
    static boolean check=true;
    static boolean checkBip=true;
    static TreeSet<Integer>[]list;
    private static long aLong=(long)(Math.pow(10,9)+7);
    static final long div=998244353;
    static  int answer=0;
    static int[]countSubTree;
    static int[]colorNode;
    static boolean con=true;
    static ArrayList<Integer>dfsPath=new ArrayList<>();
    static ArrayList<Integer>ans=new ArrayList<>();
    static boolean[]rec;
    static int min=Integer.MAX_VALUE;
    static ArrayList<Task>tasks=new ArrayList<>();
    static  boolean []checkpath;
    static long []out;
    static TreeSet<Integer>[]dp;
    private static void solve() throws IOException {
        long l=sc.nextLong(),r=sc.nextLong();
        int maxPow=(int)(Math.log(r)/Math.log(2));
        long val=(long)Math.pow(2,maxPow);
        long anss=0;
        if (l==r)anss=0;
        else if (r-1==l)anss=l^r;
        else {
            while (true){
                if (val>=l){
                    anss=2l*val-1;
                    break;
                }
                else {
                    l-=val;
                    r-=val;
                    maxPow=(int)(Math.log(r)/Math.log(2));
                    //pr.println("maxp:"+maxPow);
                    val=(long)Math.pow(2,maxPow);
                }
            }
        }
        pr.println(anss);
    }
    public static class pp{
        int val,pos;

        public pp(int val, int pos) {
            this.val = val;
            this.pos = pos;
        }
    }
    public static class dsu{
        int []rank;
        int[]parent;
        long []sum;
        int n;
        public dsu(int n) {
            this.n = n;
            parent=new int[n];
            rank=new int[n];
            sum=new long[n];
            for (int i=0;i<n;++i){
                rank[i]=1;
                parent[i]=i;
                sum[i]=0;
            }
        }
        public int dad(int child){
            if (parent[child]==child)return child;
            else return dad(parent[child]);
        }
        public void merge(int u,int v){
            int dadU=dad(u);
            int dadV=dad(v);
            if (dadU==dadV)return ;
            if (u!=v){
                if (rank[u]<rank[v]){
                    parent[u]=v;
                    rank[v]+=rank[u];
                }
                else if (rank[u]==rank[v]){
                    parent[u]=v;
                    rank[v]+=rank[u];
                }
                else{
                    parent[v]=u;
                    rank[u]+=rank[v];
                }
            }
        }
    }
    public static long power(long x,long y,long mods){
        if (y==0) return 1%mods;
        long u=power(x,y/2,mods);
        u=((u)*(u))%mods;
        if (y%2==1) u=(u*(x%mods))%mods;
        return u;
    }
    public static class Task implements Comparable<Task>{
        long l,r;
        public Task(long w,long v) {
            this.l=w;
            this.r=v;
        }

        @Override
        public int compareTo(Task o) {
            if (o.l<this.l)return 1;
            else if (o.l>this.l)return -1;
            else {
                if (o.r>this.r)return 1;
                else if (o.r<this.r)return -1;
            }
            return 0;
        }
    }
    public static void printSolve(StringBuilder str, int[] colors, int n,int color){
        for(int i = 1;i<=n;++i)
            if(colors[i] == color)
                str.append(i + " ");
        str.append('\n');
    }
    public static class pairTask{
        int  val;
        int size;
        public pairTask(int   x, int  y) {
            this.val = x;
            this.size = y;
        }
    }
    public static void subTree(int src,int parent,int x){
        countSubTree[src]=1;
        if (src==x) {
            checkpath[src]=true;
            //System.out.println("src:"+src);
        }
        else checkpath[src]=false;
        for (int v:list[src]){
            if (v==parent)
                continue;
            subTree(v,src,x);
            countSubTree[src]+=countSubTree[v];
            checkpath[src]|=checkpath[v];
        }
    }
    public static boolean prime(long src){
        for (int i=2;i*i<=src;i++){
            if (src%i==0)
                return false;
        }
        return true;
    }
    public static void bfsColor(int src){
        Queue<Integer>queue = new ArrayDeque<>();
        queue.add(src);
        while (!queue.isEmpty()){
            boolean b=false;
            int vertex=-1,p=-1;
            int poll=queue.remove();
            for (int v:list[poll]){
                if (color [v]==0){
                    vertex=v;
                    break;
                }
            }
            for (int v:list[poll]){
                if (color [v]!=0&&v!=vertex){
                    p=v;
                    break;
                }
            }
            for (int v:list[p]){
                if (color [v]!=0){
                    color[vertex]=color[v];
                    b=true;
                    break;
                }
            }
            if (!b){
                color[vertex]=color[poll]+1;
            }
        }
    }
    static int add(int a,int b ){
        if (a+b>=div)
            return (int)(a+b-div);
        return (int)a+b;
    }
    public static int isBipartite(ArrayList<Integer>[]list,int src){
        color[src]=0;
        Queue<Integer>queue=new LinkedList<>();
        int []ans={0,0};
        queue.add(src);
        while (!queue.isEmpty()){
            ans[color[src=queue.poll()]]++;
            for (int v:list[src]){
                if (color[v]==-1){
                    queue.add(v);
                    color[v]=color[src]^1;
                }else if (color[v]==color[src])
                    check=false;
            }
        }
        return add(pow[ans[0]],pow[ans[1]]);
    }
    public static int powerMod(long b, long e){
        long ans=1;
        while (e-->0){
            ans=ans*b%div;
        }
        return (int)ans;
    }
    public static int dfs(int s){
        int ans=1;
        visited[s]=true;
        for (int k:list[s]){
            if (!visited[k]){
                ans+=dfs(k);
            }
        }
        return ans;
    }
    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }
    public static long []primeFactor(int n){
        long []prime=new long[n+1];
        prime[1]=1;
        for (int i=2;i<=n;i++)
            prime[i]=((i&1)==0)?2:i;
        for (int i=3;i*i<=n;i++){
            if (prime[i]==i){
                for (int j=i*i;j<=n;j+=i){
                    if (prime[j]==j)
                        prime[j]=i;
                }
            }
        }
        return prime;
    }
    public static StringBuilder binaryradix(long number){
        StringBuilder builder=new StringBuilder();
        long remainder;
        while (number!=0) {
            remainder = number % 2;
            number >>= 1;
            builder.append(remainder);
        }
        builder.reverse();
        return builder;
    }
    public static int binarySearch(long[] a, int index,long target) {
            int l = index;
            int h = a.length - 1;
            while (l<=h) {
                int med = l + (h-l)/2;
                if(a[med] - target <= target) {
                    l = med + 1;
                }
                else h = med  - 1;
            }
            return h;
    }
    public static int val(char c){
        return c-'0';
    }
    public static long gcd(long a,long b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }
        private static class Pair implements Comparable<Pair> {
            long x;
            long y;

            Pair() {
                this.x = 0;
                this.y = 0;
            }

            Pair(long x, long y) {
                this.x = x;
                this.y = y;
            }

            @Override
            public boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                if (obj == null) return false;
                Pair other = (Pair) obj;
                if (this.x == other.x && this.y == other.y) {
                    return true;
                }
                return false;
            }

            @Override
            public int compareTo(Pair other) {
                if (this.x != other.x) return Long.compare(this.x, other.x);
                return Long.compare(this.y*other.x, this.x*other.y);
            }
    }

    public static void main(String[] args) throws IOException {
        sc = new Scanner(System.in);
        pr = new Printer(System.out);
        solve();

        pr.close();
       // sc.close();
    }
    private static class Scanner {
        BufferedReader br;

        Scanner (InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        private boolean isPrintable(int ch) {
            return ch >= '!' && ch <= '~';
        }

        private boolean isCRLF(int ch) {
            return ch == '\n' || ch == '\r' || ch == -1;
        }

        private int nextPrintable() {
            try {
                int ch;
                while (!isPrintable(ch = br.read())) {
                    if (ch == -1) {
                        throw new NoSuchElementException();
                    }
                }

                return ch;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        String next() {
            try {
                int ch = nextPrintable();
                StringBuilder sb = new StringBuilder();
                do {
                    sb.appendCodePoint(ch);
                } while (isPrintable(ch = br.read()));

                return sb.toString();
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        int nextInt() {
            try {
                // parseInt from Integer.parseInt()
                boolean negative = false;
                int res = 0;
                int limit = -Integer.MAX_VALUE;
                int radix = 10;

                int fc = nextPrintable();
                if (fc < '0') {
                    if (fc == '-') {
                        negative = true;
                        limit = Integer.MIN_VALUE;
                    } else if (fc != '+') {
                        throw new NumberFormatException();
                    }
                    fc = br.read();
                }
                int multmin = limit / radix;

                int ch = fc;
                do {
                    int digit = ch - '0';
                    if (digit < 0 || digit >= radix) {
                        throw new NumberFormatException();
                    }
                    if (res < multmin) {
                        throw new NumberFormatException();
                    }
                    res *= radix;
                    if (res < limit + digit) {
                        throw new NumberFormatException();
                    }
                    res -= digit;

                } while (isPrintable(ch = br.read()));

                return negative ? res : -res;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        long nextLong() {
            try {
                // parseLong from Long.parseLong()
                boolean negative = false;
                long res = 0;
                long limit = -Long.MAX_VALUE;
                int radix = 10;

                int fc = nextPrintable();
                if (fc < '0') {
                    if (fc == '-') {
                        negative = true;
                        limit = Long.MIN_VALUE;
                    } else if (fc != '+') {
                        throw new NumberFormatException();
                    }
                    fc = br.read();
                }
                long multmin = limit / radix;

                int ch = fc;
                do {
                    int digit = ch - '0';
                    if (digit < 0 || digit >= radix) {
                        throw new NumberFormatException();
                    }
                    if (res < multmin) {
                        throw new NumberFormatException();
                    }
                    res *= radix;
                    if (res < limit + digit) {
                        throw new NumberFormatException();
                    }
                    res -= digit;

                } while (isPrintable(ch = br.read()));

                return negative ? res : -res;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        float nextFloat() {
            return Float.parseFloat(next());
        }

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

        String nextLine() {
            try {
                int ch;
                while (isCRLF(ch = br.read())) {
                    if (ch == -1) {
                        throw new NoSuchElementException();
                    }
                }
                StringBuilder sb = new StringBuilder();
                do {
                    sb.appendCodePoint(ch);
                } while (!isCRLF(ch = br.read()));

                return sb.toString();
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        void close() {
            try {
                br.close();
            } catch (IOException e) {
//				throw new NoSuchElementException();
            }
        }
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }

    static class List {
        String Word;
        int length;

        List(String Word, int length) {
            this.Word = Word;
            this.length = length;
        }
    }
    private static class Printer extends PrintWriter {
        Printer(PrintStream out) {
            super(out);
        }
    }
}

import java.util.Scanner;

public class D {
	public static void main(String [] args){
		Scanner in = new Scanner(System.in);
		long a = in.nextLong();
		long b = in.nextLong();
		String sa = Long.toBinaryString(a);
		String sb = Long.toBinaryString(b);
		long ans = 0;
		if(sb.length()-sa.length()>0){
			for(int i = 0 ; i < sb.length() ; i++){
				ans += 1l<<i;
			}
			System.out.println(ans);
		}
		else{
			int num = 0 ;
			for(int i = 62 ; i >= 0 ; i--){
				if((a & 1l << i) != 0 && (b & 1l << i) == 0){
					num = i;
					break;
				}
			}
			ans = 0;
			for(int i = 0 ; i <= num+1 ; i ++){
				ans += 1l<<i;
			}
			System.out.println(ans);
	}
	}

}

import java.util.Scanner;

/**
 * @Created by sbhowmik on 09/10/18
 */
public class LittleGirlAndXor {

    public static void main(String []args) {

        Scanner scanner = new Scanner(System.in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        long xor = Integer.MIN_VALUE;
        for (long k = a; a < b; a++) {
            long z = (k^(k+1));
            if (z > xor) {
                xor = z;
            }
        }
        System.out.print(xor);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

	public void solve() throws IOException {
		long A = nextLong();
		long B = nextLong();
		long max = Math.max(A, B);
		long min = Math.min(A, B);
		char[] maxS = Long.toBinaryString(max).toCharArray();
		char[] minS = Long.toBinaryString(min).toCharArray();
		char[] ans = maxS.clone();

//		System.out.println( maxS.length + ", " + minS.length);
		int diff = maxS.length - minS.length;
		for(int i = 0; i < minS.length; i++){
			if( maxS[i+diff] == minS[i]){
				ans[i+diff] = '0';

				if( minS[i] == '0' && diff > 0){
					for(int j = i; j < minS.length; j++){
						ans[j+diff] = '1';
					}
					break;
				}
			}
			else{
				for(int j = i; j < minS.length; j++){
					ans[j+diff] = '1';
				}
				break;
			}
		}

//		if( maxS.length > minS.length ){
//			int diff = maxS.length - minS.length;
//			for(int i = 0; i < minS.length; i++){
//				if( maxS[i+diff] == minS[i]){
//					ans[i+diff] = '0';
//				}
//				else{
//					for(int j = i; j < minS.length; j++){
//						ans[j+diff] = '1';
//					}
//					break;
//				}
//			}
//		}
//		else{
//
//			for(int i = 0; i < ans.length; i++){
//				if( maxS[i] == '1' && minS[i] == '1'){
//					ans[i] = '0';
//				}
//				else if( maxS[i] == '0' && minS[i] == '0'){
//
//				}
//				else{
//					for(int j = i+1; j < ans.length; j++){
//						ans[j] = '1';
//					}
//					break;
//				}
//			}
//		}

		long o = 0;
		for(int i = 0; i < ans.length; i++){
			if(ans[i] == '1'){
				o += Math.pow(2, ans.length-1-i);
			}
		}
		out.println(o);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new D().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

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

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

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    long getMax(int length){
    	long ret = 0;
    	for(int i = 0; i < length; i++){
			ret += Math.pow(2, i-1);
		}
    	return ret;
    }

	public void solve() throws IOException {
		long A = nextLong();
		long B = nextLong();
		long max = Math.max(A, B);
		long min = Math.min(A, B);
		char[] maxS = Long.toBinaryString(max).toCharArray();
		char[] minS = Long.toBinaryString(min).toCharArray();
		char[] ans = maxS.clone();

//		System.out.println( maxS.length + ", " + minS.length);

		int diff = maxS.length - minS.length;
		long cMin = min;
		long cMax = max;
		for(int i = 0; i < maxS.length; i++){
			long need = (long) Math.pow(2, ans.length-1-i);
			if( maxS[i] == '1'){
				if( need > cMin){
					cMin = need;
				}
				else{
					ans[i] = '0';
				}
			}
			else{
				if( need < cMax){
					cMax = need;
					ans[i] = '1';
				}
			}
		}
//
//		for(int i = 0; i < minS.length; i++){
//
//
//			if( maxS[i+diff] == '0'){
//				long need = (long) Math.pow(2, ans.length-1-i);
//
//				if( need >= getMax(minS.length) && need >= cMin){
//					ans[i+diff] = '1';
//					cMin += Math.pow(2, ans.length-1-i);
//				}
//			}
//
//			if( maxS[i+diff] == minS[i]){
//				ans[i+diff] = '0';
//
//				if( minS[i] == '0' && diff > 0){
//					for(int j = i+1; j < minS.length; j++){
//						ans[j+diff] = '1';
//					}
//					break;
//				}
//			}
//			else{
//				for(int j = i; j < minS.length; j++){
//					ans[j+diff] = '1';
//				}
//				break;
//			}
//		}
//
//
//		if( maxS.length > minS.length ){
//			int diff = maxS.length - minS.length;
//			for(int i = 0; i < minS.length; i++){
//				if( maxS[i+diff] == minS[i]){
//					ans[i+diff] = '0';
//
//					if( minS[i] == '0' && diff > 0){
//						for(int j = i+1; j < minS.length; j++){
//							ans[j+diff] = '1';
//						}
//						break;
//					}
//				}
//				else{
//					for(int j = i; j < minS.length; j++){
//						ans[j+diff] = '1';
//					}
//					break;
//				}
//			}
//		}
//		else{
//
//			for(int i = 0; i < ans.length; i++){
//				if( maxS[i] == '1' && minS[i] == '1'){
//					ans[i] = '0';
//				}
//				else if( maxS[i] == '0' && minS[i] == '0'){
//
//				}
//				else{
//					for(int j = i+1; j < ans.length; j++){
//						ans[j] = '1';
//					}
//					break;
//				}
//			}
//		}
//
		long o = 0;
		for(int i = 0; i < ans.length; i++){
			if(ans[i] == '1'){
				o += Math.pow(2, ans.length-1-i);
			}
		}
		out.println(o);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new D().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

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

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

}

import java.util.Scanner;

public class D {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String l = Long.toBinaryString(in.nextLong());
        String h = Long.toBinaryString(in.nextLong());
        if (l .equals(h)) {
            System.out.println(0);
        } else {
            for (int i = 0; i < h.length() - l.length(); i++) {
                l = "0" + l;
            }
            char[] low = l.toCharArray();
            char[] high = h.toCharArray();
            int i;
            for (i = 0; i < high.length; i++) {
                if (high[i] > low[i]) {
                    break;
                }
            }
            i++;
            for (; i < high.length; i++) {
                high[i] = '1';
            }
            String ans = "";
            for (int j = 0; j < high.length; j++) {
                ans = ans + high[j];
            }
            System.out.println(Long.parseLong(ans, 2));
        }
    }

}

import java.awt.Point;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import static java.lang.Math.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Character.*;
import static java.lang.String.*;
@SuppressWarnings("unused")

public class round169D {
    static PrintWriter out = new PrintWriter(System.out);
    static BufferedReader br = new BufferedReader(new InputStreamReader(
            System.in));
    static StringTokenizer st = new StringTokenizer("");
    static int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    static String next() throws Exception {
        while (true) {
            if (st.hasMoreTokens()) {
                return st.nextToken();
            }
            String s = br.readLine();
            if (s == null) {
                return null;
            }
            st = new StringTokenizer(s);
        }
    }
    public static void main(String[] args)throws Exception {
        long l = parseLong(next());
        long r = parseLong(next());
        long [] min = new long [62];
        for(int i = 1 ; i <= 61 ; ++i){//(2^i)-1 is obtained by min[i]^min[i]+1
            min[i] = (long) pow(2, i - 1) - 1;
        }
        for(int i = 61 ; i >= 0 ; --i){//try to get 2^i-1 as answer.
            if(min[i] >= r)
                continue;
            if(min[i] >= l && min[i] + 1 <= r){
                out.println((long)(pow(2, i) - 1));
                out.flush();
                return;
            }
            if(min[i] < l){
                long one_jump = (long) pow(2, i);
                long  jumps = (long) ceil((l - min[i]) / (one_jump * 1.0));
                long cur = min[i] + (jumps * one_jump);
                if(cur >= l && cur <= r){
                    out.println((long)(pow(2, i) - 1));
                    out.flush();
                    return;
                }
            }
        }
    }
}

import java.util.*;
import java.io.*;
public class a {
public static void main(String[] args) throws IOException
{

    //Scanner input = new Scanner(new File("input.txt"));
    //PrintWriter out = new PrintWriter(new File("output.txt"));
    PrintWriter out = new PrintWriter(System.out);
    input.init(System.in);
    long a = input.nextLong(), b = input.nextLong();
    if(a==b)
    {
        out.println(0);
        out.close();
        return;
    }
    long res = 0;
    for(int i = 0; i<63; i++)
    {
        if(a%(1l<<i) >= b%(1l<<i))
            res += (1l<<i);
        else if(b/(2*(1l<<i)) > a/(2*(1l<<i)))
            res += (1l<<i);
    }
    out.println(res);
    out.close();
}
public static long gcd(long a, long b)
{
if(b == 0) return a;
return gcd(b, a%b);
}
public static class input {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

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

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}
static class IT
{
    int[] left,right, val, a, b;
    IT(int n)
    {
        left = new int[3*n];
        right = new int[3*n];
        val = new int[3*n];
        a = new int[3*n];
        b = new int[3*n];
        init(0,0, n);
    }
    int init(int at, int l, int r)
    {
        a[at] = l;
        b[at] = r;
        if(l==r)
            left[at] = right [at] = -1;
        else
        {
            int mid = (l+r)/2;
            left[at] = init(2*at+1,l,mid);
            right[at] = init(2*at+2,mid+1,r);
        }
        return at++;
    }
    //return the sum over [x,y]
    int get(int x, int y)
    {
        return go(x,y, 0);
    }
    int go(int x,int y, int at)
    {
        if(at==-1) return 0;
        if(x <= a[at] && y>= b[at]) return val[at];
        if(y<a[at] || x>b[at]) return 0;
        return go(x, y, left[at]) + go(x, y, right[at]);
    }
    //add v to elements x through y
    void add(int x, int y, int v)
    {
        go3(x, y, v, 0);
    }
    void go3(int x, int y, int v, int at)
    {
        if(at==-1) return;
        if(y < a[at] || x > b[at]) return;
        val[at] += (Math.min(b[at], y) - Math.max(a[at], x) + 1)*v;
        go3(x, y, v, left[at]);
        go3(x, y, v, right[at]);
    }
}
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author vadimmm
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long l = in.nextLong();
        long r = in.nextLong();
        long max = 1;
        for (int i = 0; i < 62; ++i) {
            max <<= 1;
            if (max > r) {
                max >>= 1;
                break;
            }
        }
        if (max - 1 >= l) {
            out.println(max ^ (max - 1));
            return;
        }
        out.println(max ^ r);
    }
}

class InputReader {

    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        stringTokenizer = null;
    }

    public String next() {
        while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

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

    }

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

public class Solution{
	static PrintWriter out=new PrintWriter(System.out);
	public static void main (String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] temp=br.readLine().trim().split(" ");

	    long l=Long.parseLong(temp[0]);
	    long r=Long.parseLong(temp[1]);

	    out.println(maxXor(l,r));

		out.flush();
		out.close();
	}
	public static long maxXor(long l,long r)
	{
	    long ans=l^r;
	    for(int i=0;i<63;i++){
	        if( (l&(1L<<i)) != 0  && (r&(1L<<i)) != 0 )
	        {
	            long temp=(l^(1L<<i));
	            if(temp>=l){
	                ans=(ans|(1L<<i));
	            }
	            else{
	                break;
	            }
	        }
	        else if((l&(1L<<i)) == 0  && (r&(1L<<i)) == 0){
	            long temp=(l|(1L<<i));
	            if(temp<=r)
	            {
	                ans=(ans|(1L<<i));
	            }
	            else{
	                break;
	            }
	        }
	    }
	    return ans;
	}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.*;

public class codeforces {

    static long pow[] = new long[100];

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder("");
        StringTokenizer st;
        long l , r;
        st = new StringTokenizer(br.readLine());
        l = Long.parseLong(st.nextToken());
        r = Long.parseLong(st.nextToken());
        int bitCountL = 0 , bitCountR = 0;
        long temp = l;
        Stack<Integer> sr = new Stack<Integer>();
        Stack<Integer> sl = new Stack<Integer>();
        while(temp > 0) {
            sl.push((int)temp&1);
            temp = temp >> 1;
            bitCountL++;
        }
        temp = r;
        while(temp > 0) {
            sr.push((int)temp&1);
            temp = temp >> 1;
            bitCountR++;
        }
        if(bitCountL != bitCountR) {
            System.out.println((int)Math.pow(2 , bitCountR) - 1);
        }
        else {
            int same = 0;
            while(!sr.isEmpty() && !sl.isEmpty()) {
                if(!sr.pop().equals(sl.pop())) {
                    break;
                }
                same++;
            }
            System.out.println((int) Math.pow(2 , bitCountL - same) - 1);
        }

    }

}
/*
2
3 3
2500 2500 2520
10 -5 -20
10 15 20
-15 17 13
2 3
2125 2098
-20 10 -10
10 10 -20
 */

import java.util.Scanner;

public class _10_Little_and_max_xor {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		long l = scn.nextLong();
		long r = scn.nextLong();
if(l==r){
	System.out.println(0);
	return;
		}
		long val=func(l, r);

		while(((val)&(val-1))==0){

			val=func(l-val, r-val);
		}

		System.out.println(val);
	}
	public static long func(long l,long r){
		boolean b = false;
		long max=0;
		for (int i = 0; i < 63; i++) {
			long val = (long) Math.pow(2, i);
			if (val > l && val <= r) {
				b = true;
				max = val;
				break;
			} else if (val <= l) {
				max = val;
			}
		}
		if (b) {
			return (max + max - 1);
		}return max;
	}

}

/*We are given two coins of value x and y. We have to find the maximum of value of a XOR b where x <= a <= b <= y.

Input Format
We are given two integers x and y

Constraints
l <= r <= 1000

Output Format
Print the maximum value of a XOR b

Sample Input
5
6
Sample Output
3

Explanation
If a and b are taken to be 5. Then a xor b = 0
If a and b are taken to be 6. Then a xor b = 0
If a is 5 and b is 6. Then a xor b is 3.*/

import java.math.BigInteger;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger x = sc.nextBigInteger();
        BigInteger y = sc.nextBigInteger();

        if(x.equals(y)){
            System.out.println(0);
            return;
        }

        // get 1st set bit position ||         // get the no of bits in the numbers
        int firstSetBitPosX = 0;
        int firstSetBitPosY = 0;
        BigInteger tempX = x;
        BigInteger tempY = y;
        while(tempX.getLowestSetBit() != -1){
            firstSetBitPosX++;
            tempX = tempX.shiftRight(1);
        }
        while(tempY.getLowestSetBit() != -1){
            firstSetBitPosY++;
            tempY = tempY.shiftRight(1);
        }

        // flips between since 1st bit
        int bitsToCheck = Math.max(firstSetBitPosX,firstSetBitPosY);
        while(bitsToCheck-- > 0){
            int bitX = x.testBit(bitsToCheck) ? 1 : 0;
            int bitY = y.testBit(bitsToCheck) ? 1 : 0;
            if((bitX ^ bitY ) != 1){
                if(bitX == 0)
                    x = x.flipBit(bitsToCheck);
                else
                    y = y.flipBit(bitsToCheck);
            }
        }
        System.out.println(x.xor(y));

    }
}

import java.io.PrintWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class Main
{
	static class Reader
	{
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader()
		{
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException
		{
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException
		{
			byte[] buf = new byte[64]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1)
			{
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException
		{
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
			{
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException
		{
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			}
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException
		{
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			}
			while ((c = read()) >= '0' && c <= '9');

			if (c == '.')
			{
				while ((c = read()) >= '0' && c <= '9')
				{
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException
		{
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException
		{
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException
		{
			if (din == null)
				return;
			din.close();
		}
	}

        static int[] findbits(long x){
         int p=0;
         int ans[]=new int[64];
         while(x!=0){
          ans[p]+=(x%2);p++;x/=2;
         }
         return ans;
        }

	public static void main(String[] args) throws IOException
	{
		Reader s=new Reader();PrintWriter pw=new PrintWriter(System.out);
		long l=s.nextLong(),r=s.nextLong();long ans=0;int i;
                if(l==r)ans=0;
                else{
                 int la[]=findbits(l),ra[]=findbits(r);
                 for(i=63;i>=0;i--){
                  if(la[i]!=ra[i])break;
                 }
                 int st=i;ans+=(long)Math.pow(2,st);
                 for(i=st-1;i>=0;i--){
                  if(la[i]==ra[i]){
                   long no1=r^(1<<i),no2=l^(1<<i);
                   if((no1>=l&&no1<=r)||(no2>=l&&no2<=r))ans+=(long)Math.pow(2,i);
                  }
                  else ans+=(long)Math.pow(2,i);
                 }
                }
                pw.write(String.valueOf(ans));
                pw.flush();pw.close();
	}
}

/**
 * Created with IntelliJ IDEA.
 * User: Venky
 */
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws IOException {
        long l = nextLong();
        long r = nextLong();
        if(l == r)
        {
            out.println("0");
            return;
        }
        String binaryL = Long.toBinaryString(l);
        StringBuffer binaryR = new StringBuffer(Long.toBinaryString(r));
        boolean flag1 = false;
        for(int i=0;i<binaryR.length() - binaryL.length();i++)
        {
            if(binaryR.charAt(i) == '0')
            {
                binaryR.setCharAt(i, '1');
                flag1 = true;
            }
        }
        int nowInd = binaryR.length() - binaryL.length();
        for(int i=nowInd; i<binaryR.length(); i++)
        {
            if(binaryR.charAt(i) == '1' && binaryL.charAt(i-nowInd) == '1')
            {
                if(!flag1)
                    binaryR.setCharAt(i, '0');
            }
            else if(binaryR.charAt(i) == '0')
            {
                binaryR.setCharAt(i, '1');
                if(binaryL.charAt(i-nowInd) == '0')
                    flag1 = true;
            }
        }
        long ans = Long.parseLong(binaryR.toString(), 2);
        if(ans == l)
            out.println("0");
        else out.println(ans);
    }

    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        InputStream input = System.in;
        PrintStream output = System.out;
        br = new BufferedReader(new InputStreamReader(input));
        out = new PrintWriter(output);
        solve();
        out.close();
    }

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

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

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

    static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }
}

import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);

        long l = scn.nextLong();
        long r = scn.nextLong();
        int ans = 0;
        for(int i = 63; i >= 0;i--){
            if((l >> i) != (r >> i)){
                ans = (1<<i + 1) - 1;
                break;
            }
        }

        System.out.println(ans);
    }

}

import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class littleXOR {

    static void Bolo_Jai_Mata_Di() {

        long l=nl();long r=nl();

        tsc();

        pl(maxXORInRange(l,r));

        tec();                  //calculates the ending time of execution
        //pwt();                //prints the time taken to execute the program

        flush();
    }

    static long maxXORInRange(long L, long R)
    {
       long LXR = L ^ R;

        //  loop to get msb position of L^R
        int msbPos = 0;
        while (LXR > 0)
        {
            msbPos++;
            LXR >>= 1;
        }

        // construct result by adding 1,
        // msbPos times
        int maxXOR = 0;
        int two = 1;
        while (msbPos-- >0)
        {
            maxXOR += two;
            two <<= 1;
        }

        return maxXOR;
    }

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    static Calendar ts, te;                                                  //For time calculation
    static int mod9 = 1000000007;
    static int n, m, t, mod = 998244353;
    static Lelo input = new Lelo(System.in);
    static PrintWriter pw = new PrintWriter(System.out, true);

    public static void main(String[] args) {                                 //threading has been used to increase the stack size.

        new Thread(null, null, "BlackRise", 1 << 25)  //the last parameter is stack size which is desired,
        {
            public void run() {

                try {
                    Bolo_Jai_Mata_Di();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }

    static class Lelo {                                              //Lelo class for fast input
        private InputStream ayega;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public Lelo(InputStream ayega) {
            this.ayega = ayega;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = ayega.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    // functions to take input//
    static int ni() {
        return input.nextInt();
    }

    static long nl() {
        return input.nextLong();
    }

    static double nd() {
        return input.nextDouble();
    }

    static String ns() {
        return input.readString();
    }

    //functions to give output
    static void pl() {
        pw.println();
    }

    static void p(Object o) {
        pw.print(o + " ");
    }

    static void pws(Object o) {
        pw.print(o + "");
    }

    static void pl(Object o) {
        pw.println(o);
    }

    static void tsc()                                          //calculates the starting time of execution
    {
        ts = Calendar.getInstance();
        ts.setTime(new Date());
    }

    static void tec()                                          //calculates the ending time of execution
    {
        te = Calendar.getInstance();
        te.setTime(new Date());
    }

    static void pwt()                                          //prints the time taken for execution
    {
        pw.printf("\nExecution time was :- %f s\n", (te.getTimeInMillis() - ts.getTimeInMillis()) / 1000.00);
    }

    static void flush() {
        pw.flush();
        pw.close();
    }

    static void sort(int ar[]) {
        for (int i = 0; i < n; i++) {
            int ran = (int) (Math.random() * n);
            int temp = ar[i];
            ar[i] = ar[ran];
            ar[ran] = temp;
        }
        Arrays.sort(ar);
    }

    static void sort(long ar[]) {
        for (int i = 0; i < n; i++) {
            int ran = (int) (Math.random() * n);
            long temp = ar[i];
            ar[i] = ar[ran];
            ar[ran] = temp;
        }
        Arrays.sort(ar);
    }

    static void sort(char ar[]) {
        for (int i = 0; i < n; i++) {
            int ran = (int) (Math.random() * n);
            char temp = ar[i];
            ar[i] = ar[ran];
            ar[ran] = temp;
        }
        Arrays.sort(ar);
    }
}

import java.util.Scanner;

public class D {
	int dp[][] = new int[100][3];

	public static void main(String[] args) {
		Scanner myScanner = new Scanner(System.in);
		l = myScanner.nextLong();
		r = myScanner.nextLong();
		long res = 0;
		boolean ok = false;
		int start = 0;

		for (int i = 0; i < 63; i++)
			if ((r & (1l << i)) > 0)
				start = i;
		System.out.println(Long.toBinaryString(l));
		System.out.println(Long.toBinaryString(r));
		System.out.println(Long.toBinaryString(1152921504606846975l));

		for (int i = start; i >= 0; i--) {
			if (!ok && (l & (1l << i)) > 0) {

				res |= (1l << i);
				long tmp = r;

				tmp |= (1l << i);
				tmp ^= (1l << i);
				if (tmp >= l)
					r = tmp;

			} else if ((r & (1l << i)) == 0) {

				if ((l & (1l << i)) == 0)
					ok = true;

				res |= (1l << i);
			}
		}
		System.out.println(res);
		System.out.println(r);
		System.out.println(res ^ r);
	}

	static long l, r;
}