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

ans = float('inf')

left = 0
right = sum(arr)

for i in range(N):
    left += arr[i]
    right -= arr[i]
    ans = min(ans, abs(left-right))

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 = float('inf') ans float('inf') float 'inf' left = 0 left 0 right = sum(arr) right sum(arr) sum arr for i in range(N):
    left += arr[i]
    right -= arr[i]
    ans = min(ans, abs(left-right)) i range(N) range N left += arr[i] left arr[i] arr i right -= arr[i] right arr[i] arr i ans = min(ans, abs(left-right)) ans min(ans, abs(left-right)) min ans abs(left-right) abs left-right left right print(ans) print ans left += arr[i] arr[i] left ans = min(ans, abs(left-right)) min(ans, abs(left-right)) ans ans = float('inf') float('inf') ans arr = list(map(int, input().split())) list(map(int, input().split())) arr left = 0 0 left right = sum(arr) sum(arr) right right -= arr[i] arr[i] right N = int(input()) int(input()) N
N = int(input())
arr = list(map(int, input().split()))

ans = float('inf')

left = 0
right = sum(arr)

for i in range(N):
    left += arr[i]
    right -= arr[i]
    ans = min(ans, abs(left-right))

print(ans)