N=int(input())
arr=list(map(int,input().split()))

ans=1000

for i in range(1,N):
    temp=abs(sum(arr[0:i])-sum(arr[i:]))
    ans=min(ans,temp)

print(ans) N=int(input()) N int(input()) int input() input arr=list(map(int,input().split())) arr list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans=1000 ans 1000 for i in range(1,N):
    temp=abs(sum(arr[0:i])-sum(arr[i:]))
    ans=min(ans,temp) i range(1,N) range 1 N temp=abs(sum(arr[0:i])-sum(arr[i:])) temp abs(sum(arr[0:i])-sum(arr[i:])) abs sum(arr[0:i])-sum(arr[i:]) sum(arr[0:i]) sum arr[0:i] arr 0:i 0 i sum(arr[i:]) sum arr[i:] arr i: i ans=min(ans,temp) ans min(ans,temp) min ans temp print(ans) print ans temp=abs(sum(arr[0:i])-sum(arr[i:])) abs(sum(arr[0:i])-sum(arr[i:])) temp N=int(input()) int(input()) N ans=min(ans,temp) min(ans,temp) ans arr=list(map(int,input().split())) list(map(int,input().split())) arr ans=1000 1000 ans
N=int(input())
arr=list(map(int,input().split()))

ans=1000

for i in range(1,N):
    temp=abs(sum(arr[0:i])-sum(arr[i:]))
    ans=min(ans,temp)

print(ans)