n = int(input())
l = list(map(int, input().split()))

res = float('inf')
total = sum(l)
w = 0
for i in range(n):
    w += l[i]
    res = min(abs(w - (total - w)), res)
print(res) 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 res = float('inf') res float('inf') float 'inf' total = sum(l) total sum(l) sum l w = 0 w 0 for i in range(n):
    w += l[i]
    res = min(abs(w - (total - w)), res) i range(n) range n w += l[i] w l[i] l i res = min(abs(w - (total - w)), res) res min(abs(w - (total - w)), res) min abs(w - (total - w)) abs w - (total - w) w total - w total w res print(res) print res total = sum(l) sum(l) total n = int(input()) int(input()) n res = float('inf') float('inf') res w = 0 0 w res = min(abs(w - (total - w)), res) min(abs(w - (total - w)), res) res l = list(map(int, input().split())) list(map(int, input().split())) l w += l[i] l[i] w
n = int(input())
l = list(map(int, input().split()))

res = float('inf')
total = sum(l)
w = 0
for i in range(n):
    w += l[i]
    res = min(abs(w - (total - w)), res)
print(res)