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