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

res = 101
for i in range(len(W)):
    left  = sum(W[:i])
    right = sum(W[i:])
    if res > abs(left-right):
        res = abs(left-right)

print(res) 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 res = 101 res 101 for i in range(len(W)):
    left  = sum(W[:i])
    right = sum(W[i:])
    if res > abs(left-right):
        res = abs(left-right) i range(len(W)) range len(W) len W left  = sum(W[:i]) left sum(W[:i]) sum W[:i] W :i i right = sum(W[i:]) right sum(W[i:]) sum W[i:] W i: i if res > abs(left-right):
        res = abs(left-right) res > abs(left-right) res abs(left-right) abs left-right left right res = abs(left-right) res abs(left-right) abs left-right left right print(res) print res res = 101 101 res N = int(input()) int(input()) N W = list(map(int, input().split())) list(map(int, input().split())) W right = sum(W[i:]) sum(W[i:]) right left  = sum(W[:i]) sum(W[:i]) left res = abs(left-right) abs(left-right) res
N = int(input())
W = list(map(int, input().split()))

res = 101
for i in range(len(W)):
    left  = sum(W[:i])
    right = sum(W[i:])
    if res > abs(left-right):
        res = abs(left-right)

print(res)