只过了样例……
#include <bits/stdc++.h>
using namespace std;
int a[101];
int main(){
int n,r;
cin>>n;
for(int i=0; i<n; i++) scanf("%d",&a[i]);
sort(a,a+n);
r=n;
for(int i=0; i<n; i++){
int x=i+1;
while(a[x]==a[i]){
a[x]=0;
r--;
x++;
}
}
cout<<r<<endl;
for(int i=0; i<n; i++){
if(a[i]!=0) cout<<a[i]<<' ';
}
return 0;
}