a = int(input())
b = list(map(int,input().split()[:a]))
c = sum(b)
for i in range(len(b)):
    c = min(c, abs(sum(b[:i]) - sum(b[i:])))
print(c) a = int(input()) a int(input()) int input() input b = list(map(int,input().split()[:a])) b list(map(int,input().split()[:a])) list map(int,input().split()[:a]) map int input().split()[:a] ().split() ().split () input split :a a c = sum(b) c sum(b) sum b for i in range(len(b)):
    c = min(c, abs(sum(b[:i]) - sum(b[i:]))) i range(len(b)) range len(b) len b c = min(c, abs(sum(b[:i]) - sum(b[i:]))) c min(c, abs(sum(b[:i]) - sum(b[i:]))) min c abs(sum(b[:i]) - sum(b[i:])) abs sum(b[:i]) - sum(b[i:]) sum(b[:i]) sum b[:i] b :i i sum(b[i:]) sum b[i:] b i: i print(c) print c c = min(c, abs(sum(b[:i]) - sum(b[i:]))) min(c, abs(sum(b[:i]) - sum(b[i:]))) c c = sum(b) sum(b) c b = list(map(int,input().split()[:a])) list(map(int,input().split()[:a])) b a = int(input()) int(input()) a
a = int(input())
b = list(map(int,input().split()[:a]))
c = sum(b)
for i in range(len(b)):
    c = min(c, abs(sum(b[:i]) - sum(b[i:])))
print(c)