codeparrot/codecomplex huggingface dataset:
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn

// @author Sanzhar
import java.io.*;
import java.util.*;
import java.awt.Point;

public class Template {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

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

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

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

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

    public void run() throws Exception {
        //in = new BufferedReader(new FileReader("input.txt"));
        //out = new PrintWriter(new FileWriter("output.txt"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.flush();
        out.close();
        in.close();
    }

    public void solve() throws Exception {
        long l = nextLong();
        long r = nextLong();
        long[] x = new long[100];
        int kx = 0;
        while (r > 0) {
            x[kx++] = r % 2;
            r /= 2;
        }
        long[] y = new long[100];
        int ky = 0;
        while (l > 0) {
            y[ky++] = l % 2;
            l /= 2;
        }
        long[] ans = new long[100];
        boolean ok = false;
        for (int k = kx - 1; k >= 0; k--) {
            if (ok) {
                ans[k] = 1;
                continue;
            }
            if (x[k] > y[k]) {
                ans[k] = 1;
                ok = true;
            }
        }
        long a = 0;
        long p2 = 1;
        for (int i = 0; i < kx; i++) {
            a += p2 * ans[i];
            p2 *= 2;
        }
        out.println(a);
    }

    public static void main(String[] args) throws Exception {
        new Template().run();
    }
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
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;
  }

  }
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
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);
    }

}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.util.*;

public class Dj {

	public static long run(long l, long r) {
		if(l == r) {
			return 0;
		}

		long[] sq2 = new long[62];
		sq2[0] = 1;
		for(int i = 1; i < 62; i++) sq2[i] = sq2[i-1]*2;

		//System.out.println(sq2[61]);

		for(int i = sq2.length - 1; i >= 0; i--) {
			//log("L = " + l + " R = " + r + " 2^" + i + "=" + sq2[i]);
			if(l >= sq2[i] && r >= sq2[i]) {
				l -= sq2[i];
				r -= sq2[i];
			} else if(l < sq2[i] && sq2[i] <= r) {
				break;
			}
		}
		for(int i = sq2.length - 1; i >= 0; i--) {
			//log("L = " + l + " R = " + r + " 2^" + i + "=" + sq2[i]);
			if(l < sq2[i] && sq2[i] <= r) {
				return sq2[i+1]-1;
			}
		}
		return -1;
	}

	public static void log(String str) {
		System.out.println(str);
	}

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

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

		System.out.println(run(l, r));
		//System.out.println(run(9999999999998l, 9999999999999l));

	}
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.util.*;
import java.io.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {
    
    boolean hasBit(long n, int pos) {
        return (n & (1L << pos)) != 0;
    }
    
    public void solve() throws Exception {
        long l = sc.nextLong(), r = sc.nextLong();
        int bit = 62;
        while (bit >= 0 && (hasBit(l, bit) == hasBit(r, bit))) {
            bit--;
        }
        out.println((1L << (bit + 1)) - 1);
    }
    
    static Throwable uncaught;
    
    BufferedReader in;
    FastScanner sc;
    PrintWriter out;
    
    @Override
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            solve();
        } catch (Throwable uncaught) {
            Solution.uncaught = uncaught;
        } finally {
            out.close();
        }
    }
    
    public static void main(String[] args) throws Throwable {
        Thread thread = new Thread (null, new Solution(), "", (1 << 26));
        thread.start();
        thread.join();
        if (Solution.uncaught != null) {
            throw Solution.uncaught;
        }
    }

}

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 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());
    }
    
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.util.*;
import static java.lang.System.*;

public class D276 {
    Scanner sc = new Scanner(in);


    public void run() {
        long l=sc.nextLong(),r=sc.nextLong();

        long tes=l^r;

        int d=0;
        while(tes!=0){
            tes/=2;
            d++;
        }
        ln((1L<<d)-1);
    }


    public static void main(String[] _) {
        new D276().run();
    }

    public static void pr(Object o) {
        out.print(o);
    }
    public static void ln(Object o) {
        out.println(o);
    }
    public static void ln() {
        out.println();
    }
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	
	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}
	
	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}
	
	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}
	
	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}
	
	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		long l = nextLong();
		long r = nextLong();

		int bit = 63;
		while(bit >= 0 && (hasBit(l, bit) == hasBit(r, bit))) {
			bit--;
		}
		System.out.println((1L<<bit+1)-1);
	}

	private boolean hasBit(long x, int i){
		return (x & (1L<<i)) > 0;
	}
		
	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
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 [61];
        for(int i = 1 ; i <= 60 ; ++i){//(2^i)-1 is obtained by min[i]^min[i]+1
            min[i] = (long) pow(2, i - 1) - 1;          
        }
        for(int i = 60 ; 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 + 1 <= r){                                       
                    out.println((long) pow(2, i) - 1);
                    out.flush();
                    return;
                }               
            }
        }
        out.println(0);
        out.flush();
    }
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import	java.util.*;
public	class	Main{
	public	static	void	main(String[]args){
		for(Scanner	cin=new	Scanner(System.in);cin.hasNextLong();System.out.println(Math.max(0,(Long.highestOneBit(cin.nextLong()^cin.nextLong())<<1)-1)));
	}
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
//package round169;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class D2 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		long L = nl(), R = nl();
		out.println(Math.max(0, Long.highestOneBit(L^R)*2-1));
	}
	
	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception { new D2().run(); }
	
	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
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 ocelopilli
 */
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 LL = in.nextLong();
        long RR = in.nextLong();

        long L = LL;
        long R = RR;
        long ans = 0L;
        long X = Long.highestOneBit( R );
        while ( X > 0L && (L & X) == (R & X) ) X >>= 1;
        while ( X > 0L )
        {
            long a = L & X;
            long b = R & X;
            if ( (a ^ b) == X ) ans |= X;
            else
            {
                if ( b == 0L )
                {
                    if ( (R | X) <= RR )
                    {
                        R |= X;
                        ans |= X;
                    }
                    else if ( (L | X) <= RR )
                    {
                        L |= X;
                        ans |= X;
                    }
                }
                else
                {
                    if ( (L ^ X) >= LL )
                    {
                        L ^= X;
                        ans |= X;
                    }
                    else if ( (R ^ X) >= LL )
                    {
                        R ^= X;
                        ans |= X;
                    }
                }
            }
            X >>= 1;
        }
        out.println( ans );
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

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

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

    public long nextLong()
    {
        return Long.parseLong(next());
    }
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author George Marcus
 */
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 left = in.nextLong();
        long right = in.nextLong();

        long ans = go(left, right);
        out.println(ans);
    }

    private long go(long A, long B) {
        int bA = -1;
        for(int i = 62; i >= 0; i--)
            if((A & (1L << i)) > 0) {
                bA = i;
                break;
            }
        int bB = -1;
        for(int i = 62; i >= 0; i--)
            if((B & (1L << i)) > 0) {
                bB = i;
                break;
            }

        if(bB == -1)
            return 0;
        if(bA < bB)
            return allOne(bB);
        else
            return go(A ^ (1L << bA), B ^ (1L << bB));
    }

    private long allOne(int bits) {
        long ret = 0;
        for(int i = 0; i <= bits; i++)
            ret |= (1L << i);
        return ret;
    }
}

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 nextLong() {
        return Long.parseLong(nextString());
    }

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

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

    }
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
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();
		}
	}
}