n=int(input())
w=list(map(int,input().split()))
S=sum(w)
ans=10000
for i in range(n-1):
    s1=0
    s2=0
    for p in range(i+1):
        s1+=w[p]
    for q in range(i+1,n):
        s2+=w[q]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2)
print(ans) n=int(input()) n int(input()) int input() input w=list(map(int,input().split())) w list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split S=sum(w) S sum(w) sum w ans=10000 ans 10000 for i in range(n-1):
    s1=0
    s2=0
    for p in range(i+1):
        s1+=w[p]
    for q in range(i+1,n):
        s2+=w[q]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2) i range(n-1) range n-1 n 1 s1=0 s1 0 s2=0 s2 0 for p in range(i+1):
        s1+=w[p]
     p range(i+1) range i+1 i 1 s1+=w[p] s1 w[p] w p for q in range(i+1,n):
        s2+=w[q]
     q range(i+1,n) range i+1 i 1 n s2+=w[q] s2 w[q] w q if abs(s1-s2)<ans:
        ans=abs(s1-s2) abs(s1-s2)<ans abs(s1-s2) abs s1-s2 s1 s2 ans ans=abs(s1-s2) ans abs(s1-s2) abs s1-s2 s1 s2 print(ans) print ans s1+=w[p] w[p] s1 ans=abs(s1-s2) abs(s1-s2) ans S=sum(w) sum(w) S ans=10000 10000 ans s2=0 0 s2 n=int(input()) int(input()) n w=list(map(int,input().split())) list(map(int,input().split())) w s1=0 0 s1 s2+=w[q] w[q] s2
n=int(input())
w=list(map(int,input().split()))
S=sum(w)
ans=10000
for i in range(n-1):
    s1=0
    s2=0
    for p in range(i+1):
        s1+=w[p]
    for q in range(i+1,n):
        s2+=w[q]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2)
print(ans)