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

ans = float('inf')

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

ans = float('inf')

for i in range(n):
  ans = min(ans, abs(sum(Ws[:i])  - sum(Ws[i:])))
print(ans)

