#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  long long int a,b,c=1000000000000,d[200000],e=0,s=0;
  cin>>a;
  for(b=0;b<a;b++){cin>>d[b];s+=d[b];}
  for(b=0;b<a-1;b++){e+=d[b];if(abs(s-2*e)<c)c=abs(s-2*e);}
  cout<<c;
return 0;
}