n=int(input())
w_list=[int(i) for i in input().split()]

sa_list=[]
for i in range(n):
    sa_list.append(abs(sum(w_list[:i+1])-sum(w_list[i+1:])))
    
print(min(sa_list)) n=int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i w_list=[int(i) for i in input().split()] w_list [int(i) for i in input().split()] sa_list=[] sa_list [] for i in range(n):
    sa_list.append(abs(sum(w_list[:i+1])-sum(w_list[i+1:])))
     i range(n) range n sa_list.append(abs(sum(w_list[:i+1])-sum(w_list[i+1:]))) sa_list.append sa_list append abs(sum(w_list[:i+1])-sum(w_list[i+1:])) abs sum(w_list[:i+1])-sum(w_list[i+1:]) sum(w_list[:i+1]) sum w_list[:i+1] w_list :i+1 i+1 i 1 sum(w_list[i+1:]) sum w_list[i+1:] w_list i+1: i+1 i 1 print(min(sa_list)) print min(sa_list) min sa_list w_list=[int(i) for i in input().split()] [int(i) for i in input().split()] w_list sa_list=[] [] sa_list n=int(input()) int(input()) n
n=int(input())
w_list=[int(i) for i in input().split()]

sa_list=[]
for i in range(n):
    sa_list.append(abs(sum(w_list[:i+1])-sum(w_list[i+1:])))
    
print(min(sa_list))