#include<stdio.h>
#include<math.h>
int main(void)
{
    int n, s[200000], sum, i, min, re, sum2;
    while( (scanf("%d", &n))!=EOF )
    {
        sum=0;
        for(i=0; i<n; i++)
        {
            scanf("%d", &s[i]);
            sum+=s[i];
        }
        sum2=s[0];
        min=abs(sum-2*s[0]);
        for(i=1;i<n-1;i++)
        {
            sum2+=s[i];
            re=abs(sum-2*sum2);
            if(re<min)
                min=re;
        }
        printf("%d\n", min);
    }
    return 0;
}