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