/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		int[] A = {2, 1, 6, 3, 5};
		int X = 7;
		int n = A.length;
		
		int[][] dp = new int[n][2]; 
		
		 
		for(int i = 1; i < n; i++){
			dp[i][0] = Math.max((A[i] ^ A[i-1]) + dp[i - 1][0], (A[i] ^ (A[i-1] + X)) + dp[i - 1][1]);
			dp[i][1] = Math.max(((A[i] + X) ^ (A[i-1] + X)) + dp[i-1][1], ((A[i] + X) ^ (A[i-1])) + dp[i-1][0]);
		}
		System.out.print( Math.max(dp[n-1][0], dp[n-1][1]));
	}
}