#include<string>
#include <iostream>
using namespace std;
int main() {
int n, max = 1;
cin >> n;
int a[100000];
for (int i = 0; i < n; i++)
cin >> a[i];
bool f = false;
for (int i = 0; i < n; i++)
{
if (a[i] < 0)
{
if (a[i] < max)
max = a[i];
f = true;
}
}
if (f)
cout << abs(max);
else
cout << 0;
}