n = int(input())
w = list(map(int, input().split()))
res = 10 ** 5
for i in range(0, n-1):
  a = abs(sum(w[:i+1]) - sum(w[i+1:]))
  if a < res:
    res = a
print(res) 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 res = 10 ** 5 res 10 ** 5 10 5 for i in range(0, n-1):
  a = abs(sum(w[:i+1]) - sum(w[i+1:]))
  if a < res:
    res = a i range(0, n-1) range 0 n-1 n 1 a = abs(sum(w[:i+1]) - sum(w[i+1:])) a abs(sum(w[:i+1]) - sum(w[i+1:])) abs sum(w[:i+1]) - sum(w[i+1:]) sum(w[:i+1]) sum w[:i+1] w :i+1 i+1 i 1 sum(w[i+1:]) sum w[i+1:] w i+1: i+1 i 1 if a < res:
    res = a a < res a res res = a res a print(res) print res n = int(input()) int(input()) n res = 10 ** 5 10 ** 5 res a = abs(sum(w[:i+1]) - sum(w[i+1:])) abs(sum(w[:i+1]) - sum(w[i+1:])) a res = a a res w = list(map(int, input().split())) list(map(int, input().split())) w
n = int(input())
w = list(map(int, input().split()))
res = 10 ** 5
for i in range(0, n-1):
  a = abs(sum(w[:i+1]) - sum(w[i+1:]))
  if a < res:
    res = a
print(res)