using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
class Solution
{
static void Main(string[] args)
{ int closestNumber = 5600;
int n = int.Parse(Console.ReadLine()); // the number of temperatures to analyse
string[] inputs = Console.ReadLine().Split(' ');
for (int i = 0; i < n; i++)
{
int t = int.Parse(inputs[i]); // a temperature expressed as an integer ranging from -273 to 5526
#If new t value's absolute value is smalller, it is closer to zero
if(Math.Abs(closestNumber)>Math.Abs(t))
{
closestNumber = t;
}
#If new t value's absolute value is equal, pick the higher one.
else if (Math.Abs(closestNumber)==Math.Abs(t))
{
closestNumber = Math.Max(closestNumber, t);
}
}
#If no values are provided, closestNumber values stays the same as we have given thus we return zero
if(closestNumber == 5600)
{
closestNumber = 0;
}
// Write an action using Console.WriteLine()
// To debug: Console.Error.WriteLine("Debug messages...");
Console.WriteLine(closestNumber);
}
}