二话不说,上代码,懒得写注释,请自己理解,另附自编符号枪
/*
$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$ @
$$$$$$$$ |
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ |
###########*************************************************************&&&&&&&&&&&& &&
###########*************************************************************** \ & &
##########****************************************************************%%%%%%%%%%%%%%%%%%%%%%%%%%%%!%%%%%%%%%%%%%!%%%%&&&&&&@
#########***************************************************************** !!!!!!!!!!!!!!!
######## #######^^^^ @ $$$$$$$$$$ !! !!
####### #######^^^ @ $$$$$$$$$$ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
####### @ $$$$$$$$$$ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#######@@@@ $$$$$$$$$$
####### $$$$$$$$$$
####### $$$$$$$$$$
####### $$$$$$$$$$
####### $$$$$$$$$$
####### $$$$$$$$$$
####### $$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
*/
#include<bits/stdc++.h>
using namespace std;
set<int> s;
int main()
{
int n,x[100000+7];
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x[i];
s.insert(x[i]);
}
cout<<s.size()<<endl;
set<int>::iterator it=s.begin();
for(it=s.begin();it!=s.end();it++)
{
cout<<*it<<" ";
}
return 0;
}