n=int(input())
w=list(map(int,input().split()))
ans=10**5
for i in range(n-1):
    s1=0
    s2=0
    for a in range(i+1):
        s1+=w[a]
    for b in range(i+1,n):
        s2+=w[b]
    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 ans=10**5 ans 10**5 10 5 for i in range(n-1):
    s1=0
    s2=0
    for a in range(i+1):
        s1+=w[a]
    for b in range(i+1,n):
        s2+=w[b]
    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 a in range(i+1):
        s1+=w[a]
     a range(i+1) range i+1 i 1 s1+=w[a] s1 w[a] w a for b in range(i+1,n):
        s2+=w[b]
     b range(i+1,n) range i+1 i 1 n s2+=w[b] s2 w[b] w b 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 ans=10**5 10**5 ans s2=0 0 s2 s2+=w[b] w[b] s2 ans=abs(s1-s2) abs(s1-s2) ans n=int(input()) int(input()) n s1+=w[a] w[a] s1 w=list(map(int,input().split())) list(map(int,input().split())) w s1=0 0 s1
n=int(input())
w=list(map(int,input().split()))
ans=10**5
for i in range(n-1):
    s1=0
    s2=0
    for a in range(i+1):
        s1+=w[a]
    for b in range(i+1,n):
        s2+=w[b]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2)
print(ans)