#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,max=0,i,min=10000,j;
    int a[9];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(max<a[i])
            max=a[i];
            if(min>a[i])
                min=a[i];
    }
    printf("%d %d",max,min);

    return 0;
}