n = int(input())
ls = list(map(int,input().split()))
max = sum(ls)
k = float("inf")
for i in range(1,n):
    a = sum(ls[:i])
    b = max - a
    if abs(b-a) < k:
        k = abs(b-a)
print(k) n = int(input()) n int(input()) int input() input ls = list(map(int,input().split())) ls list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split max = sum(ls) max sum(ls) sum ls k = float("inf") k float("inf") float "inf" for i in range(1,n):
    a = sum(ls[:i])
    b = max - a
    if abs(b-a) < k:
        k = abs(b-a) i range(1,n) range 1 n a = sum(ls[:i]) a sum(ls[:i]) sum ls[:i] ls :i i b = max - a b max - a max a if abs(b-a) < k:
        k = abs(b-a) abs(b-a) < k abs(b-a) abs b-a b a k k = abs(b-a) k abs(b-a) abs b-a b a print(k) print k max = sum(ls) sum(ls) max b = max - a max - a b n = int(input()) int(input()) n a = sum(ls[:i]) sum(ls[:i]) a k = abs(b-a) abs(b-a) k k = float("inf") float("inf") k ls = list(map(int,input().split())) list(map(int,input().split())) ls
n = int(input())
ls = list(map(int,input().split()))
max = sum(ls)
k = float("inf")
for i in range(1,n):
    a = sum(ls[:i])
    b = max - a
    if abs(b-a) < k:
        k = abs(b-a)
print(k)
