n = int(input())

t = list(map(int, input().split()))
sum_t = sum(t)
num = sum_t
count = 0
l = []

for i in t:
  sum_t -= i
  count += i
  l.append(abs(sum_t - count))

print(sorted(l)[0]) n = int(input()) n int(input()) int input() input t = list(map(int, input().split())) t list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split sum_t = sum(t) sum_t sum(t) sum t num = sum_t num sum_t count = 0 count 0 l = [] l [] for i in t:
  sum_t -= i
  count += i
  l.append(abs(sum_t - count)) i t sum_t -= i sum_t i count += i count i l.append(abs(sum_t - count)) l.append l append abs(sum_t - count) abs sum_t - count sum_t count print(sorted(l)[0]) print sorted(l)[0] (l) sorted l 0 l = [] [] l count += i i count sum_t -= i i sum_t t = list(map(int, input().split())) list(map(int, input().split())) t num = sum_t sum_t num count = 0 0 count sum_t = sum(t) sum(t) sum_t n = int(input()) int(input()) n
n = int(input())

t = list(map(int, input().split()))
sum_t = sum(t)
num = sum_t
count = 0
l = []

for i in t:
  sum_t -= i
  count += i
  l.append(abs(sum_t - count))

print(sorted(l)[0])
