N=int(input())
W=list(map(int,input().split()))

MIN=10**9
for i in range(1,N):
  diff = abs(sum(W[:i])-sum(W[i:]))
  if diff<MIN:MIN=diff
print(MIN) 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 MIN=10**9 MIN 10**9 10 9 for i in range(1,N):
  diff = abs(sum(W[:i])-sum(W[i:]))
  if diff<MIN:MIN=diff i range(1,N) range 1 N diff = abs(sum(W[:i])-sum(W[i:])) diff 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 if diff<MIN:MIN=di diff<MIN diff MIN print(MIN) print MIN MIN=10**9 10**9 MIN W=list(map(int,input().split())) list(map(int,input().split())) W N=int(input()) int(input()) N diff = abs(sum(W[:i])-sum(W[i:])) abs(sum(W[:i])-sum(W[i:])) diff
N=int(input())
W=list(map(int,input().split()))

MIN=10**9
for i in range(1,N):
  diff = abs(sum(W[:i])-sum(W[i:]))
  if diff<MIN:MIN=diff
print(MIN)