#include<stdio.h>
#define ABS(x,y) ((-x)>=(y)?(y):(x))
int GetAbsMin(int *a, int n)
{
if(a[0]>=0)return a[0];
if(a[n-1]<=0)return a[n-1];
int begin = 0;
int end = n-1;
int left = a[0];
int right = a[n-1];
int mid;
while(begin<=end)
{
mid = (begin+end)/2;
if(a[mid]==0)return 0;
if(a[mid]>0)
{
if(a[mid-1]<0)
{
left = a[mid-1];
right = a[mid];
break;
}
else
{
end = mid-1;
}
}
else
{
if(a[mid+1]>0)
{
left=a[mid];
right=a[mid+1];
break;
}
else
begin = mid + 1;
}
}
return ABS(left,right);
}
int main()
{
int n,i;
int a[100];
int result;
while(~scanf("%d",&n))
{
for(i=0;i<n;i++)
scanf("%d",&a[i]);
result = GetAbsMin(a,n);
printf("%d\n",result);
}
return 0;
}