n = int(input())
w = list(map(int,input().split()))
s0 = float('inf')
for i in range(1,n):
    s0 = min(s0,abs(sum(w[:i])-sum(w[i:])))
print(s0) 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 s0 = float('inf') s0 float('inf') float 'inf' for i in range(1,n):
    s0 = min(s0,abs(sum(w[:i])-sum(w[i:]))) i range(1,n) range 1 n s0 = min(s0,abs(sum(w[:i])-sum(w[i:]))) s0 min(s0,abs(sum(w[:i])-sum(w[i:]))) min s0 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 print(s0) print s0 n = int(input()) int(input()) n s0 = min(s0,abs(sum(w[:i])-sum(w[i:]))) min(s0,abs(sum(w[:i])-sum(w[i:]))) s0 s0 = float('inf') float('inf') s0 w = list(map(int,input().split())) list(map(int,input().split())) w
n = int(input())
w = list(map(int,input().split()))
s0 = float('inf')
for i in range(1,n):
    s0 = min(s0,abs(sum(w[:i])-sum(w[i:])))
print(s0)