#include
int ar[100000],b[100000];
void merging(int ar[],int start ,int mid,int end);
void merge(int ar[],int start,int end);
int main()
{
using namespace std;
int n;
cout<<"\n Enter total no of nos “;
cin>>n;
for(int i=0;i<n;i++)
cin>>ar[i];
merge(ar,0,n-1);
for(int i=0;i<n;i++)
{
if(i==0 || ar[i]!=ar[i-1])
cout<<ar[i]<<” ";
}
return 0;
}
void merge(int ar[],int start,int end)
{
int mid=(start+end)/2;
if(start <end )
{
merge(ar,start,mid);
merge(ar,mid+1,end);
}
merging(ar,start,mid,end);
}
void merging(int ar[],int start ,int mid,int end)
{
int a=start,k=start, c=mid+1;
while(a<=mid && c<=end)
{
if(ar[a]<ar[c])
b[k++]=ar[a++];
else
b[k++]=ar[c++];
}
if(a>mid)
while(c<=end)
b[k++]=ar[c++];
else
while(a<=mid)
b[k++]=ar[a++];
for(a=start;a<=end;a++)
ar[a]=b[a];
}