n=int(input());a=list(map(int,input().split()));m=float('inf')
for i in range(1,n): m=min(m,abs(sum(a[:i])-sum(a[i:])))
print(m) n=int(input()) n int(input()) int input() input a=list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split m=float('inf') m float('inf') float 'inf' for i in range(1,n): m=min(m,abs(sum(a[:i])-sum(a[i:]))) i range(1,n) range 1 n print(m) print m a=list(map(int,input().split())) list(map(int,input().split())) a n=int(input()) int(input()) n m=float('inf') float('inf') m
n=int(input());a=list(map(int,input().split()));m=float('inf')
for i in range(1,n): m=min(m,abs(sum(a[:i])-sum(a[i:])))
print(m)