#include<iostream>
using namespace std;
int main()
{
int i, j, k, l, m=0;
cout<<"Enter the size of array"<<endl;
cin>>i;
int A[i];
for(j=1;j<=i;j++)
{
cout<<"Enter value for array "<<j<<endl;
cin>>A[j];
}
for(j=1;j<=i;j++)
{
cout<<" "<<A[j]<<", ";
}
cout<<endl;
k=i/2;
for(l=1;l<=i;l++)
{
for(j=1;j<=i;j++)
{
if(A[j]>A[j+1])
{
m=A[j+1];
A[j+1]=A[j];
A[j]=m;
}
else if(A[j]>A[j+1])
{
m=A[j];
}
}
}
cout<<endl;
for(j=1;j<=k;j++)
{
cout<<" "<<A[j]<<", ";
}
for(j=i;j>k;j--)
{
cout<<" "<<A[j]<<", ";
}
}