#include <iostream>
#include<fstream>
#include <cmath>
using namespace std;

int main()
{
    ifstream fi("de006.inp");
    ofstream fo("de006.out");
    long int n;
    fi>>n;
    long int a[n],i,m=a[0];
    fi>>a[0];
    for (i=1;i<n;i++)
    {
        fi>>a[i];
        m=min(a[i],m);}
        if(m>=0)
    {fo<<0;
    return 0;}
    fo<<m;
    return 0;
}
