#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[10001]={0},k,f=0,e=0;
cin>>k;
for(int i=1;i<=k;i++)
{
cin>>a[i];
}
for(int j=2;j<=k;j++)
{
for(int p=1;p<=(j-1);p++)
{
if(a[j]<a[p])
{
f=a[p];
a[p]=a[j];
a[j]=f;
j=j-1;
}
}
}
for(int j=2;j<=k;j++)
{
if(a[j]==a[(j-1)])
{
for(int g=j;g<=k;g++)
{
a[g]=a[g+1];
}
}
}
for(int h=1;h<=k;h++)
{
if(a[h]!=0)
{
e++;
}
}
cout<<e<<endl;
for(int h=1;h<=k;h++)
{
if(a[h]!=0)
{
cout<<a[h]<<" ";
}
}
return 0;
}