#include<stdio.h>
void main()
{
int arr[100];
int n;
int i;
while (scanf("%d",&n) && n != 0)
{
for ( i = 0; i<n; i++)
scanf("%d",&arr[i]);
for ( i = 0; i<n; i++)
for (int j = i + 1; j<n; j++)
if (arr[i]<arr[j])
{
int t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
printf("%d\n",arr[0]);
}
}