a=int(input())
b=list(map(int,input().split()))
d=[]
for i in range(a):
    d.append(abs(sum(b[:i])-sum(b[i:])))
print(min(d)) a=int(input()) a int(input()) int input() input b=list(map(int,input().split())) b list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split d=[] d [] for i in range(a):
    d.append(abs(sum(b[:i])-sum(b[i:]))) i range(a) range a d.append(abs(sum(b[:i])-sum(b[i:]))) d.append d append abs(sum(b[:i])-sum(b[i:])) abs sum(b[:i])-sum(b[i:]) sum(b[:i]) sum b[:i] b :i i sum(b[i:]) sum b[i:] b i: i print(min(d)) print min(d) min d a=int(input()) int(input()) a b=list(map(int,input().split())) list(map(int,input().split())) b d=[] [] d
a=int(input())
b=list(map(int,input().split()))
d=[]
for i in range(a):
    d.append(abs(sum(b[:i])-sum(b[i:])))
print(min(d))