n=int(input())
l=list(map(int,input().split()))
ans=[]
x=0
for i in range(n):
    x+=l[i]
    ans.append(abs(x-(sum(l)-x)))
print(min(ans)) 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 ans=[] ans [] x=0 x 0 for i in range(n):
    x+=l[i]
    ans.append(abs(x-(sum(l)-x))) i range(n) range n x+=l[i] x l[i] l i ans.append(abs(x-(sum(l)-x))) ans.append ans append abs(x-(sum(l)-x)) abs x-(sum(l)-x) x sum(l)-x sum(l) sum l x print(min(ans)) print min(ans) min ans ans=[] [] ans n=int(input()) int(input()) n l=list(map(int,input().split())) list(map(int,input().split())) l x+=l[i] l[i] x x=0 0 x
n=int(input())
l=list(map(int,input().split()))
ans=[]
x=0
for i in range(n):
    x+=l[i]
    ans.append(abs(x-(sum(l)-x)))
print(min(ans))