clude <stdio.h>

int main(){
        int N;
        scanf("%d",&N);
        int i,a[100]={};
        for(i=0;i<N;i++){
                scanf("%d",&a[i]);
                printf("%d\n",a[i]);
        }
        int Max=0,Min=1000;
        for(i=0;i<N-1;i++){
                if(Max<a[i]){
                        Max = a[i];
                }
                if(a[i]<Min){
                        Min = a[i];
                }
        }
        printf("%d %d\n",Max, Min );
        printf("%d",Max-Min);
        return 0;
}
