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

res = 10**9
for i in range(1,n):
    a = sum(s[:i])
    b = sum(s[i:])
    res = min(res, abs(a-b))
print(res) n = int(input()) n int(input()) int input() input s = list(map(int, input().split())) s list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split res = 10**9 res 10**9 10 9 for i in range(1,n):
    a = sum(s[:i])
    b = sum(s[i:])
    res = min(res, abs(a-b)) i range(1,n) range 1 n a = sum(s[:i]) a sum(s[:i]) sum s[:i] s :i i b = sum(s[i:]) b sum(s[i:]) sum s[i:] s i: i res = min(res, abs(a-b)) res min(res, abs(a-b)) min res abs(a-b) abs a-b a b print(res) print res b = sum(s[i:]) sum(s[i:]) b res = min(res, abs(a-b)) min(res, abs(a-b)) res s = list(map(int, input().split())) list(map(int, input().split())) s res = 10**9 10**9 res n = int(input()) int(input()) n a = sum(s[:i]) sum(s[:i]) a
n = int(input())
s = list(map(int, input().split()))

res = 10**9
for i in range(1,n):
    a = sum(s[:i])
    b = sum(s[i:])
    res = min(res, abs(a-b))
print(res)
