import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); long a[] = new long[n]; String str[] = br.readLine().split(" "); for (int i = 0; i < n; i++) { a[i] = Long.parseLong(str[i]); } long dp[] = new long[1 << n]; dp[0] = 0; for (int bit = 0; bit < (1 << n); bit++) { for (int i = 0; i < n; i++) { if (((bit & (1 << i)) == 0)) continue; for (int j = i + 1; j < n; j++) { if (((bit & (1 << j)) == 0)) continue; long t = dp[bit - (1 << i) - (1 << j)] + (a[i] ^ a[j]); dp[bit] = Math.max(dp[bit], t); } } } System.out.println(dp[(1 << n) - 1]); } }