n = int(input())
mlist = list(map(int,input().split()))
nlist =[]
for i in range(n):
  nlist.append(abs(sum(mlist[:i])-sum(mlist[i:])))
print(min(nlist)) n = int(input()) n int(input()) int input() input mlist = list(map(int,input().split())) mlist list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split nlist =[] nlist [] for i in range(n):
  nlist.append(abs(sum(mlist[:i])-sum(mlist[i:]))) i range(n) range n nlist.append(abs(sum(mlist[:i])-sum(mlist[i:]))) nlist.append nlist append abs(sum(mlist[:i])-sum(mlist[i:])) abs sum(mlist[:i])-sum(mlist[i:]) sum(mlist[:i]) sum mlist[:i] mlist :i i sum(mlist[i:]) sum mlist[i:] mlist i: i print(min(nlist)) print min(nlist) min nlist nlist =[] [] nlist mlist = list(map(int,input().split())) list(map(int,input().split())) mlist n = int(input()) int(input()) n
n = int(input())
mlist = list(map(int,input().split()))
nlist =[]
for i in range(n):
  nlist.append(abs(sum(mlist[:i])-sum(mlist[i:])))
print(min(nlist))