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