x = int(input())

L = list(map(int, input().split()))

ans = 0


for i in range(x // 2):
    ans += abs(L[i] - L[x - 1 - i])

if ans < 100:
    print(ans)
else:
    print(0)