n=int(input())
a=list(map(int,input().split()))
ans=100**5
for i in range(n):
    s1=sum(a[i:])
    s2=sum(a[:i])
    ans=min(ans,abs(s1-s2))
print(ans) n=int(input()) n int(input()) int input() input a=list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans=100**5 ans 100**5 100 5 for i in range(n):
    s1=sum(a[i:])
    s2=sum(a[:i])
    ans=min(ans,abs(s1-s2)) i range(n) range n s1=sum(a[i:]) s1 sum(a[i:]) sum a[i:] a i: i s2=sum(a[:i]) s2 sum(a[:i]) sum a[:i] a :i i ans=min(ans,abs(s1-s2)) ans min(ans,abs(s1-s2)) min ans abs(s1-s2) abs s1-s2 s1 s2 print(ans) print ans ans=min(ans,abs(s1-s2)) min(ans,abs(s1-s2)) ans ans=100**5 100**5 ans a=list(map(int,input().split())) list(map(int,input().split())) a n=int(input()) int(input()) n s2=sum(a[:i]) sum(a[:i]) s2 s1=sum(a[i:]) sum(a[i:]) s1
n=int(input())
a=list(map(int,input().split()))
ans=100**5
for i in range(n):
    s1=sum(a[i:])
    s2=sum(a[:i])
    ans=min(ans,abs(s1-s2))
print(ans)