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