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