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