#include <iostream>
using namespace std;
int n,x,vmax,vmin,i,y;
int main()
{
vmax=0;
vmin=999999;
cout<<"n=";cin>>n;
for(i=1;i<=n;i++)
{
cout<<"x=";cin>>x;
if(x>vmax)
vmax=x;
if(x<vmin)
vmin=x;
}
cout<<"valoarea maxima="<<vmax<<endl;
cout<<"valoarea minima="<<vmin<<endl;
x=vmax;
y=vmin;
vmax=vmin;
y=x;
cout<<vmax<<" "<<y;
return 0;
}