n = int(input())
lisw = list(map(int,input().split()))

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

total = 100000000
for i in range(1,n):
  total = min(total,abs(sum(lisw[:i])-sum(lisw[i:])))
  
print(total)