from itertools import combinations def is_continuous(iter): previous = None for v in iter: if previous is None: previous = v continue if v - previous == 1: return True return False times = int(input()) data = [ int(x) for x in input().split(' ') ] max_length = int(times / 2 + times % 2) result = -1 for i in range(max_length): length = i + 1 for comb in combinations(range(times), max_length): tmp = 0 if is_continuous(comb): continue for index in comb: tmp += data[index] if result < tmp: result = tmp print(result)