import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): N = int(input()) A = getlist() Lsum = [0] * N Rsum = [0] * N Lsum[0] = A[0] - A[1] Rsum[-1] = A[-1] - A[-2] for i in range(1, N): Lsum[i] = Lsum[i - 1] + A[2 * i] - A[2 * i + 1] Rsum[-1 - i] = Rsum[-i] + A[-1 - 2 * i] - A[-2 - 2 * i] if N == 1: print(abs(A[0] - A[1])) return ans = -INF for i in range(N - 1): ans = max(ans, Lsum[i] + Rsum[i + 1]) print(ans) if __name__ == '__main__': main()