双指针
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 110;
int a[N];
int main(){
int n; cin >> n;
for(int i = 0; i < n; i ++ ) cin >> a[i];
sort(a, a + n);
int i = 0, j = i + 1;
int k = 0;
while(i < n){
if(a[i] == a[j]) j ++ ;
else a[k ++ ] = a[i], i = j, j = i + 1;
}
cout << k << endl;
for(int i = 0; i < k; i ++ ) cout << a[i] << ' ';
return 0;
}