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

for i in range(n+1):
  # print(sum(w[:i]), sum(w[i:]))
  tmp = abs(sum(w[:i])-sum(w[i:]))
  if ans > tmp:
    ans = tmp
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 = 100000000 ans 100000000 for i in range(n+1):
  # print(sum(w[:i]), sum(w[i:]))
  tmp = abs(sum(w[:i])-sum(w[i:]))
  if ans > tmp:
    ans = tmp i range(n+1) range n+1 n 1 tmp = abs(sum(w[:i])-sum(w[i:])) tmp 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 ans > tmp:
    ans = tmp ans > tmp ans tmp ans = tmp ans tmp print(ans) print ans n = int(input()) int(input()) n ans = tmp tmp ans tmp = abs(sum(w[:i])-sum(w[i:])) abs(sum(w[:i])-sum(w[i:])) tmp w = list(map(int, input().split())) list(map(int, input().split())) w ans = 100000000 100000000 ans
n = int(input())
w = list(map(int, input().split()))
ans = 100000000

for i in range(n+1):
  # print(sum(w[:i]), sum(w[i:]))
  tmp = abs(sum(w[:i])-sum(w[i:]))
  if ans > tmp:
    ans = tmp
print(ans)