import numpy as np

import sys

n = int(eval(input()))

w = list(map(int,input().split()))

print((min(abs(sum(w[:i+1])-sum(w[i+1:])) for i in range(n-1))))

n=int(eval(input()))

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

ans=100

for i in range(n):

    lw=sum(W[:i+1])

    rw=sum(W[i+1:])

    ans=min(ans,abs(lw-rw))

print(ans)
import numpy as np
import sys

n = int(eval(input()))
w = list(map(int, input().split()))
print((min(abs(sum(w[: i + 1]) - sum(w[i + 1 :])) for i in range(n - 1))))

n = int(eval(input()))
W = list(map(int, input().split()))
ans = 100
for i in range(n):
    lw = sum(W[: i + 1])
    rw = sum(W[i + 1 :])
    ans = min(ans, abs(lw - rw))
print(ans)

-import numpy as np -import sys - -w = list(map(int, input().split())) -print((min(abs(sum(w[: i + 1]) - sum(w[i + 1 :])) for i in range(n - 1)))) +W = list(map(int, input().split())) +ans = 100 +for i in range(n): +    lw = sum(W[: i + 1]) +    rw = sum(W[i + 1 :]) +    ans = min(ans, abs(lw - rw)) +print(ans)