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