program diafora(input, output);
var N, i, j, temp, thesi, min : integer;
    a : array[1..1000000] of integer;

begin
 readln(N);
 thesi:= 0;
 i:= 0;
 while i < N do
 begin
  i:= i + 1;
  read(a[i]);
  if a[i] > 0 then thesi:= i
 end;
 readln;
 if thesi = 1 then writeln(a[1] + a[2])
 else if thesi = 0 then writeln(a[N - 1] + a[N])
 else
 begin
  if thesi < N then min:= a[thesi] + a[thesi + 1];
  if thesi > 2 then temp:= -(a[thesi - 1] + a[thesi - 2]);
  if temp < min then min:= temp;
  i:= 0;
  j:= thesi - 1;
  while i < thesi - 2 do
  begin
   i:= i + 1;
   while j < N do
   begin
    j:= j + 1;
    temp:= a[i] + a[j];
    if abs(temp) < abs(min) then min:= temp
   end
  end;
  writeln(min)
 end
end.