n=int(input())
w=list(map(int, input().split()))

ans=10**10

for t in range(1,n):
    ans=min(ans,abs(sum(w[0:t])-sum(w[t:])))
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**10 ans 10**10 10 10 for t in range(1,n):
    ans=min(ans,abs(sum(w[0:t])-sum(w[t:]))) t range(1,n) range 1 n ans=min(ans,abs(sum(w[0:t])-sum(w[t:]))) ans min(ans,abs(sum(w[0:t])-sum(w[t:]))) min ans abs(sum(w[0:t])-sum(w[t:])) abs sum(w[0:t])-sum(w[t:]) sum(w[0:t]) sum w[0:t] w 0:t 0 t sum(w[t:]) sum w[t:] w t: t print(ans) print ans n=int(input()) int(input()) n ans=10**10 10**10 ans w=list(map(int, input().split())) list(map(int, input().split())) w ans=min(ans,abs(sum(w[0:t])-sum(w[t:]))) min(ans,abs(sum(w[0:t])-sum(w[t:]))) ans
n=int(input())
w=list(map(int, input().split()))

ans=10**10

for t in range(1,n):
    ans=min(ans,abs(sum(w[0:t])-sum(w[t:])))
print(ans)