x = int(input())
y = [int(z) for z in input().split()]
m = 100000000000000
s = sum(y)
for i in range(x):
      m = min(m, abs(sum(y[i+1:])-sum(y[:i+1])))
print(m) x = int(input()) x int(input()) int input() input int(z) for z in input().split() for z in input().split() z input().split() ().split () input split for z in input().split() int(z) int z y = [int(z) for z in input().split()] y [int(z) for z in input().split()] m = 100000000000000 m 100000000000000 s = sum(y) s sum(y) sum y for i in range(x):
      m = min(m, abs(sum(y[i+1:])-sum(y[:i+1]))) i range(x) range x m = min(m, abs(sum(y[i+1:])-sum(y[:i+1]))) m min(m, abs(sum(y[i+1:])-sum(y[:i+1]))) min m abs(sum(y[i+1:])-sum(y[:i+1])) abs sum(y[i+1:])-sum(y[:i+1]) sum(y[i+1:]) sum y[i+1:] y i+1: i+1 i 1 sum(y[:i+1]) sum y[:i+1] y :i+1 i+1 i 1 print(m) print m y = [int(z) for z in input().split()] [int(z) for z in input().split()] y s = sum(y) sum(y) s x = int(input()) int(input()) x m = 100000000000000 100000000000000 m m = min(m, abs(sum(y[i+1:])-sum(y[:i+1]))) min(m, abs(sum(y[i+1:])-sum(y[:i+1]))) m
x = int(input())
y = [int(z) for z in input().split()]
m = 100000000000000
s = sum(y)
for i in range(x):
      m = min(m, abs(sum(y[i+1:])-sum(y[:i+1])))
print(m)
