import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int p = (int)Math.pow(2, n); int[] dp = new int[p]; for(int i = 1; i < p; i++) { for(int j = 0; j < n; j++) { if((i & (1 << j)) != 0) { for(int k = j + 1; k < n; k++) { if((i & (1 << k)) != 0) { int i1 = i - (1 << j) - (1 << k); int t = dp[i1]; t += (a[j] ^ a[k]); dp[i] = Math.max(dp[i], t); } } } } } System.out.println(dp[p - 1]); } }