N = int(input())
W = list(map(int,input().split()))
ans = 1000000
for i in range(N):
  num = abs(sum(W[:i])-sum(W[i:]))
  ans = min(num,ans)
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 = 1000000 ans 1000000 for i in range(N):
  num = abs(sum(W[:i])-sum(W[i:]))
  ans = min(num,ans) i range(N) range N num = abs(sum(W[:i])-sum(W[i:])) num 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(num,ans) ans min(num,ans) min num ans print(ans) print ans W = list(map(int,input().split())) list(map(int,input().split())) W num = abs(sum(W[:i])-sum(W[i:])) abs(sum(W[:i])-sum(W[i:])) num ans = min(num,ans) min(num,ans) ans N = int(input()) int(input()) N ans = 1000000 1000000 ans
N = int(input())
W = list(map(int,input().split()))
ans = 1000000
for i in range(N):
  num = abs(sum(W[:i])-sum(W[i:]))
  ans = min(num,ans)
print(ans)