n = int(input())
list1 = list(map(int, input().split()))
great = 9999999
for i in range(n - 1):
  temp = int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:])))
  if temp < great:
    great = temp
print(great) n = int(input()) n int(input()) int input() input list1 = list(map(int, input().split())) list1 list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split great = 9999999 great 9999999 for i in range(n - 1):
  temp = int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:])))
  if temp < great:
    great = temp i range(n - 1) range n - 1 n 1 temp = int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:]))) temp int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:]))) int abs(sum(list1[:i + 1]) - sum(list1[i + 1:])) abs sum(list1[:i + 1]) - sum(list1[i + 1:]) sum(list1[:i + 1]) sum list1[:i + 1] list1 :i + 1 i + 1 i 1 sum(list1[i + 1:]) sum list1[i + 1:] list1 i + 1: i + 1 i 1 if temp < great:
    great = temp temp < great temp great great = temp great temp print(great) print great n = int(input()) int(input()) n great = 9999999 9999999 great list1 = list(map(int, input().split())) list(map(int, input().split())) list1 temp = int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:]))) int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:]))) temp great = temp temp great
n = int(input())
list1 = list(map(int, input().split()))
great = 9999999
for i in range(n - 1):
  temp = int(abs(sum(list1[:i + 1]) - sum(list1[i + 1:])))
  if temp < great:
    great = temp
print(great)
