n=int(input())
w=list(map(int,input().split()))
ans=float('inf')
for i in range(1,len(w)):
  sabun=abs(sum(w[:i])-sum(w[i:]))
  ans=min(ans,sabun)
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=float('inf') ans float('inf') float 'inf' for i in range(1,len(w)):
  sabun=abs(sum(w[:i])-sum(w[i:]))
  ans=min(ans,sabun) i range(1,len(w)) range 1 len(w) len w sabun=abs(sum(w[:i])-sum(w[i:])) sabun abs(sum(w[:i])-sum(w[i:])) abs sum(w[:i])-sum(w[i:]) sum(w[:i]) sum w[:i] w :i i sum(w[i:]) sum w[i:] w i: i ans=min(ans,sabun) ans min(ans,sabun) min ans sabun print(ans) print ans sabun=abs(sum(w[:i])-sum(w[i:])) abs(sum(w[:i])-sum(w[i:])) sabun n=int(input()) int(input()) n ans=float('inf') float('inf') ans w=list(map(int,input().split())) list(map(int,input().split())) w ans=min(ans,sabun) min(ans,sabun) ans
n=int(input())
w=list(map(int,input().split()))
ans=float('inf')
for i in range(1,len(w)):
  sabun=abs(sum(w[:i])-sum(w[i:]))
  ans=min(ans,sabun)
print(ans)