n=int(input())
l=list(map(int,input().split()))
ans=100000
for i in range(n-1):
    ans=min(ans,abs(sum(l[:i+1])-sum(l[i+1:])))
print(ans) n=int(input()) n int(input()) int input() input l=list(map(int,input().split())) l list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans=100000 ans 100000 for i in range(n-1):
    ans=min(ans,abs(sum(l[:i+1])-sum(l[i+1:]))) i range(n-1) range n-1 n 1 ans=min(ans,abs(sum(l[:i+1])-sum(l[i+1:]))) ans min(ans,abs(sum(l[:i+1])-sum(l[i+1:]))) min ans abs(sum(l[:i+1])-sum(l[i+1:])) abs sum(l[:i+1])-sum(l[i+1:]) sum(l[:i+1]) sum l[:i+1] l :i+1 i+1 i 1 sum(l[i+1:]) sum l[i+1:] l i+1: i+1 i 1 print(ans) print ans ans=min(ans,abs(sum(l[:i+1])-sum(l[i+1:]))) min(ans,abs(sum(l[:i+1])-sum(l[i+1:]))) ans n=int(input()) int(input()) n ans=100000 100000 ans l=list(map(int,input().split())) list(map(int,input().split())) l
n=int(input())
l=list(map(int,input().split()))
ans=100000
for i in range(n-1):
    ans=min(ans,abs(sum(l[:i+1])-sum(l[i+1:])))
print(ans)