a[1010],s=1e5,t,*q=a;c(int*a,int*b){t=*a-*b;}main(p){for(;~scanf("%d",q);q++);for(qsort(a+2,q-a-2,4,c);--q>a+*a;tabs(p=q[1-*a])?*q:p),*q*p<0?t=*q*2-p*2-t:0;s=!printf("%d",s);}