n = int(input())
W = list(map(int,input().split()))

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

mins=sum(W)
for i in range(n):
    t=abs(sum(W[:i])-sum(W[i:]))
    mins = min(mins, t)
print(mins)