N = int(input())
W = input().split()
W = [int(i) for i in W]

min1 = 10**6
for i in range(N):
    ans = abs(sum(W[:i+1])-sum(W[i+1:]))
    if ans < min1:
        min1 = int(ans)
print(min1) N = int(input()) N int(input()) int input() input W = input().split() W input().split() ().split () input split int(i) for i in W for i in W i W for i in W int(i) int i W = [int(i) for i in W] W [int(i) for i in W] min1 = 10**6 min1 10**6 10 6 for i in range(N):
    ans = abs(sum(W[:i+1])-sum(W[i+1:]))
    if ans < min1:
        min1 = int(ans) i range(N) range N ans = abs(sum(W[:i+1])-sum(W[i+1:])) ans abs(sum(W[:i+1])-sum(W[i+1:])) abs sum(W[:i+1])-sum(W[i+1:]) sum(W[:i+1]) sum W[:i+1] W :i+1 i+1 i 1 sum(W[i+1:]) sum W[i+1:] W i+1: i+1 i 1 if ans < min1:
        min1 = int(ans) ans < min1 ans min1 min1 = int(ans) min1 int(ans) int ans print(min1) print min1 min1 = int(ans) int(ans) min1 min1 = 10**6 10**6 min1 N = int(input()) int(input()) N W = input().split() input().split() W W = [int(i) for i in W] [int(i) for i in W] W ans = abs(sum(W[:i+1])-sum(W[i+1:])) abs(sum(W[:i+1])-sum(W[i+1:])) ans
N = int(input())
W = input().split()
W = [int(i) for i in W]

min1 = 10**6
for i in range(N):
    ans = abs(sum(W[:i+1])-sum(W[i+1:]))
    if ans < min1:
        min1 = int(ans)
print(min1)
