x = int(input()) L = list(map(int, input().split())) ans = 0 for i in range(x // 2): ans += min(L[i], L[x - 1 - i]) print(ans)