n=int(eval(input()))

a=list(map(int,input().split()))

sa=sum(a)

hantei=2*(10**9)+1

sx=0

for i in range(len(a)-1):

  sx+=a[i]

  if abs(sa-2*sx)<hantei:

    hantei=abs(sa-2*sx)

print(hantei)
n=int(eval(input()))

#a,b=map(int,input().split())

a=list(map(int,input().split()))

#n=int(input())

#s=input()



sa=sum(a)

ans=10**10+1

x=0

for i in range(0,n-1):

  x+=a[i]

  if abs(2*x-sa)<ans:

    ans=abs(2*x-sa)

print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
sa = sum(a)
hantei = 2 * (10**9) + 1
sx = 0
for i in range(len(a) - 1):
    sx += a[i]
    if abs(sa - 2 * sx) < hantei:
        hantei = abs(sa - 2 * sx)
print(hantei)

n = int(eval(input()))
# a,b=map(int,input().split())
a = list(map(int, input().split()))
# n=int(input())
# s=input()
sa = sum(a)
ans = 10**10 + 1
x = 0
for i in range(0, n - 1):
    x += a[i]
    if abs(2 * x - sa) < ans:
        ans = abs(2 * x - sa)
print(ans)

+# a,b=map(int,input().split()) +# n=int(input()) +# s=input() -hantei = 2 * (10**9) + 1 -sx = 0 -for i in range(len(a) - 1): -    sx += a[i] -    if abs(sa - 2 * sx) < hantei: -        hantei = abs(sa - 2 * sx) -print(hantei) +ans = 10**10 + 1 +x = 0 +for i in range(0, n - 1): +    x += a[i] +    if abs(2 * x - sa) < ans: +        ans = abs(2 * x - sa) +print(ans)