N=int(input())
L=list(map(int, input().split()))
s=sum(L)
A=[]
for i in range(N+1):
  t=sum(L[:i])
  A.append(abs(t-(s-t)))
print(min(A)) N=int(input()) N int(input()) int input() input L=list(map(int, input().split())) L list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split s=sum(L) s sum(L) sum L A=[] A [] for i in range(N+1):
  t=sum(L[:i])
  A.append(abs(t-(s-t))) i range(N+1) range N+1 N 1 t=sum(L[:i]) t sum(L[:i]) sum L[:i] L :i i A.append(abs(t-(s-t))) A.append A append abs(t-(s-t)) abs t-(s-t) t s-t s t print(min(A)) print min(A) min A A=[] [] A N=int(input()) int(input()) N s=sum(L) sum(L) s t=sum(L[:i]) sum(L[:i]) t L=list(map(int, input().split())) list(map(int, input().split())) L
N=int(input())
L=list(map(int, input().split()))
s=sum(L)
A=[]
for i in range(N+1):
  t=sum(L[:i])
  A.append(abs(t-(s-t)))
print(min(A))