num = int(input())
weight = list(map(int, input().split()))

d = []
for i in range(len(weight)):
  d.append(abs(sum(weight[:i])-sum(weight[i:])))
  
print(min(d)) num = int(input()) num int(input()) int input() input weight = list(map(int, input().split())) weight list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split d = [] d [] for i in range(len(weight)):
  d.append(abs(sum(weight[:i])-sum(weight[i:])))
   i range(len(weight)) range len(weight) len weight d.append(abs(sum(weight[:i])-sum(weight[i:]))) d.append d append abs(sum(weight[:i])-sum(weight[i:])) abs sum(weight[:i])-sum(weight[i:]) sum(weight[:i]) sum weight[:i] weight :i i sum(weight[i:]) sum weight[i:] weight i: i print(min(d)) print min(d) min d num = int(input()) int(input()) num weight = list(map(int, input().split())) list(map(int, input().split())) weight d = [] [] d
num = int(input())
weight = list(map(int, input().split()))

d = []
for i in range(len(weight)):
  d.append(abs(sum(weight[:i])-sum(weight[i:])))
  
print(min(d))